Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Struts: bean:write error: No getter method for property:

Reply
Thread Tools

Struts: bean:write error: No getter method for property:

 
 
silvia.fama@googlemail.com
Guest
Posts: n/a
 
      04-10-2008
Hi!
I've a problem using Struts 1.2

I have a bean VisualizzaVeicoloForm

public class VisualizzaVeicoloForm extends ActionForm {
Veicolo veicolo = null;
public Veicolo getVeicolo() {
return veicolo;
}
public void setVeicolo(Veicolo veicolo) {
this.veicolo = veicolo;
}

String getTarga(){
return veicolo.getTarga();
}
}

public class Veicolo extends AbstractVeicolo implements
java.io.Serializable {
private Integer veicoloId = null;
private Utente utente = null;
private String targa = null;
private String modello = null;
private String marca = null;
private Integer anno = null;
....
public String getTarga() {
return targa;
}
....
}

my JSP:
<html>
<head>
<title>JSP for VisualizzaVeicoloForm form</title>
</head>
<body>
<html:form action="/visualizzaVeicolo">
<bean:define id="veicolo" value="visualizzaVeicoloForm"
property="veicolo"/>
<bean:write property="targa" name="veicolo"/>
<html:submit/><html:cancel/>
</html:form>
</body>
</html>

I have the following error: javax.servlet.jsp.JspException: No getter
method for property: "targa" of bean: "veicolo"

struts config file seems ok!

May someone help me?
Thank you!
 
Reply With Quote
 
 
 
 
Tim Slattery
Guest
Posts: n/a
 
      04-10-2008
"(E-Mail Removed)" <(E-Mail Removed)> wrote:


>public class Veicolo extends AbstractVeicolo implements
> <bean:write property="targa" name="veicolo"/>



>I have the following error: javax.servlet.jsp.JspException: No getter
>method for property: "targa" of bean: "veicolo"


Java is case sensitive. You either need to name your class "veicolo"
or use name="Veicolo" in your JSP page.

--
Tim Slattery
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://members.cox.net/slatteryt
 
Reply With Quote
 
 
 
 
silvia.fama@googlemail.com
Guest
Posts: n/a
 
      04-10-2008
On 10 Apr, 11:46, "(E-Mail Removed)"
<(E-Mail Removed)> wrote:
> Hi!
> I've a problem using Struts 1.2
>
> I have a bean VisualizzaVeicoloForm
>
> public class VisualizzaVeicoloForm extends ActionForm {
> Veicolo veicolo = null;
> public Veicolo getVeicolo() {
> return veicolo;
> }
> public void setVeicolo(Veicolo veicolo) {
> this.veicolo = veicolo;
> }
>
> String getTarga(){
> return veicolo.getTarga();
> }
>
> }
>
> public class Veicolo extends AbstractVeicolo implements
> java.io.Serializable {
> private Integer veicoloId = null;
> private Utente utente = null;
> private String targa = null;
> private String modello = null;
> private String marca = null;
> private Integer anno = null;
> ....
> public String getTarga() {
> return targa;
> }
> ...
>
> }
>
> my JSP:
> <html>
> <head>
> <title>JSP for VisualizzaVeicoloForm form</title>
> </head>
> <body>
> <html:form action="/visualizzaVeicolo">
> <bean:define id="veicolo" value="visualizzaVeicoloForm"
> property="veicolo"/>
> <bean:write property="targa" name="veicolo"/>
> <html:submit/><html:cancel/>
> </html:form>
> </body>
> </html>
>
> I have the following error: javax.servlet.jsp.JspException: No getter
> method for property: "targa" of bean: "veicolo"
>
> struts config file seems ok!
>
> May someone help me?
> Thank you!


I solved the problem usin "nested" tag.

Thank you!
 
Reply With Quote
 
Donkey Hot
Guest
Posts: n/a
 
      04-10-2008
Tim Slattery <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> "(E-Mail Removed)" <(E-Mail Removed)> wrote:
>
>
>>public class Veicolo extends AbstractVeicolo implements
>> <bean:write property="targa" name="veicolo"/>

>
>
>>I have the following error: javax.servlet.jsp.JspException: No getter
>>method for property: "targa" of bean: "veicolo"

>
> Java is case sensitive. You either need to name your class "veicolo"
> or use name="Veicolo" in your JSP page.
>


name="veicolo" is a reference to a bean instance (object), not the class of
it.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do any Java compilers or JVMs optimize getter method calls? david.karr Java 19 09-05-2009 01:07 AM
Problems invoking a getter method using reflection? Pep Java 5 07-08-2009 03:49 PM
Struts - Getter method mpprpp@yahoo.com Java 6 08-11-2008 09:34 PM
logic:iterate - no getter method sibasish Java 0 03-21-2006 06:38 AM
Struts issue... "No getter method for property..." goa_head Java 6 04-25-2004 04:46 PM



Advertisments