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

S

silvia.fama

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!
 
T

Tim Slattery

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.
 
S

silvia.fama

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!
 
D

Donkey Hot

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top