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

Discussion in 'Java' started by silvia.fama@googlemail.com, Apr 10, 2008.

  1. Guest

    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!
    , Apr 10, 2008
    #1
    1. Advertising

  2. Tim Slattery Guest

    "" <> 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://members.cox.net/slatteryt
    Tim Slattery, Apr 10, 2008
    #2
    1. Advertising

  3. Guest

    On 10 Apr, 11:46, ""
    <> 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!
    , Apr 10, 2008
    #3
  4. Donkey Hot Guest

    Tim Slattery <> wrote in
    news::

    > "" <> 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.
    Donkey Hot, Apr 10, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. goa_head
    Replies:
    6
    Views:
    9,861
    Andrew Thompson
    Apr 25, 2004
  2. Thomas P. Fuller
    Replies:
    1
    Views:
    4,511
    bitbucket43
    Aug 17, 2004
  3. jill
    Replies:
    5
    Views:
    15,531
  4. Replies:
    6
    Views:
    819
  5. DaFoot
    Replies:
    1
    Views:
    1,664
    DaFoot
    Oct 23, 2008
Loading...

Share This Page