You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jean-Baptiste Onofré <jb...@phpfr.org> on 2003/04/28 13:48:50 UTC

Form bean accessor

Hello all,

i have a JSP that present a form like this :

<html:form action="/something.do" method="POST">
<html:select name="object" property="type.id">
<html:options collections="objectList" property="id"
labelProperty="label"/>
</html:select>
<html:text name="object" property="name"/>
</html:form>

I would to connect a ActionForm but how is the form of the attribute for
type.id field ???

In my ActionForm, i have try :
...
private int typeId;
private int type_id;
...

but i don't work :(

Someone can help me please ?

Best regards
-- 
Jean-Baptiste Onofré (Nanthrax)
Membre fondateur de phpFR.org
http://www.phpfr.org
jbonofre@phpfr.org
Membre fondateur du LUG Béziers
http://www.lug-beziers.org
jbonofre@lug-beziers.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Form bean accessor

Posted by Jean-Baptiste Onofré <jb...@phpfr.org>.
Hello

Le lun, avr 28, 2003 at 02:31:03 +0200, Noureddine Bekrar a écrit :
> Hello JB;
> 
> the problem is not in the name of the field in your actionform but the
> setter and the getter names  .
> 
> for a call like this in the jsp:    property="myproperty">
> a getter must be called : getMyproperty()
> 
> an other example
> 
> for a call like this in the jsp:    property="myProperty">
> a getter must be called : getMyProperty()
> 


Yes i know that, with a standard property like "myProperty" the accessor
work fine 
...
public String getMyProperty() ...
...

but with composed property like "type.id" i don't know the form of the
accessor : getTypeId(), getTypeid(), getType_Id() ???

Must i redefine the bean with <bean:define id="myProperty" name="object"
property="type.id"/> ??

Best regards
-- 
Jean-Baptiste Onofré (Nanthrax)
Membre fondateur de phpFR.org
http://www.phpfr.org
jbonofre@phpfr.org
Membre fondateur du LUG Béziers
http://www.lug-beziers.org
jbonofre@lug-beziers.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Form bean accessor

Posted by Noureddine Bekrar <nb...@rennes.jouve.fr>.
Hello JB;

the problem is not in the name of the field in your actionform but the
setter and the getter names  .

for a call like this in the jsp:    property="myproperty">
a getter must be called : getMyproperty()

an other example

for a call like this in the jsp:    property="myProperty">
a getter must be called : getMyProperty()







----- Original Message -----
From: "Jean-Baptiste Onofré" <jb...@phpfr.org>
To: <st...@jakarta.apache.org>
Sent: Monday, April 28, 2003 1:48 PM
Subject: Form bean accessor


> Hello all,
>
> i have a JSP that present a form like this :
>
> <html:form action="/something.do" method="POST">
> <html:select name="object" property="type.id">
> <html:options collections="objectList" property="id"
> labelProperty="label"/>
> </html:select>
> <html:text name="object" property="name"/>
> </html:form>
>
> I would to connect a ActionForm but how is the form of the attribute for
> type.id field ???
>
> In my ActionForm, i have try :
> ...
> private int typeId;
> private int type_id;
> ...
>
> but i don't work :(
>
> Someone can help me please ?
>
> Best regards
> --
> Jean-Baptiste Onofré (Nanthrax)
> Membre fondateur de phpFR.org
> http://www.phpfr.org
> jbonofre@phpfr.org
> Membre fondateur du LUG Béziers
> http://www.lug-beziers.org
> jbonofre@lug-beziers.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org