You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nitesh Naveen <ni...@cordiant.net> on 2005/07/01 13:29:34 UTC

RE: deal with nested properties

You should probably have...

<form-bean name="questionnaireForm"
type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="page" type="java.lang.Integer" initial="1"/>
      <form-property name="firstName" type="java.lang.String" initial="Nom"
/>
      <form-property name="lastName" type="java.lang.String" />
     <form-property name="child" type="java.lang.String" initial="N"/>
      <form-property name="numChild" type="java.lang.Integer" initial="0"/>
      <form-property name=" children " type="package.Personne[]" />
</form-bean>

HTH
Nitesh


-----Original Message-----
From: Dewitte Rémi [mailto:remi@gide.net] 
Sent: Friday, July 01, 2005 5:54 PM
To: Struts Users Mailing List
Subject: deal with nested properties

Hi all !
I have another problem to submit :

Here is my bean
<form-bean name="questionnaireForm" 
type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="page" type="java.lang.Integer" initial="1"/>
      <form-property name="firstName" type="java.lang.String" initial="Nom"
/>
      <form-property name="lastName" type="java.lang.String" />
     <form-property name="child" type="java.lang.String" initial="N"/>
      <form-property name="numChild" type="java.lang.Integer" initial="0"/>
</form-bean>

where Personne is a class of two attributes {name,age} with their getters
and 
setters.

In my jsp, I try do do this :

<bean:define id="numChild" name="questionnaireForm" property="numChild" 
type="java.lang.Integer"/>
<c:forEach begin="1" end='<%=numChild.intValue()%>' var="ind">
<bean:define name="ind" id="ind2" type="java.lang.Integer"/>
<tr>
<td><bean:write name="ind"/></td>
<td><html:text property='<%="children["+(ind2.intValue()-1)+"].name"%>' 
size="30" maxlength="30"/></td>
<td><html:text property='<%="children["+(ind2.intValue()-1)+"].age"%>' 
size="30" maxlength="30"/></td>
</tr>
</c:forEach>

And i get this error : 
No getter method for property children[0].name of bean 
org.apache.struts.taglib.html.BEAN

Following the Struts FAQ for Indexed properties, it seems it should work...

Please tell me what I missed.
Rémi

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



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


Re: deal with nested properties

Posted by Dewitte Rémi <re...@gide.net>.
Yes sorry, i have also :
<form-property name="children" type="net.gide.webapp.Personne[]"/>
But it doesn't work !
Rémi

Le Vendredi 1 Juillet 2005 13:29, Nitesh Naveen a écrit :
> You should probably have...
>
> <form-bean name="questionnaireForm"
> type="org.apache.struts.validator.DynaValidatorForm">
>       <form-property name="page" type="java.lang.Integer" initial="1"/>
>       <form-property name="firstName" type="java.lang.String" initial="Nom"
> />
>       <form-property name="lastName" type="java.lang.String" />
>      <form-property name="child" type="java.lang.String" initial="N"/>
>       <form-property name="numChild" type="java.lang.Integer" initial="0"/>
>       <form-property name=" children " type="package.Personne[]" />
> </form-bean>
>
> HTH
> Nitesh
>
>
> -----Original Message-----
> From: Dewitte Rémi [mailto:remi@gide.net]
> Sent: Friday, July 01, 2005 5:54 PM
> To: Struts Users Mailing List
> Subject: deal with nested properties
>
> Hi all !
> I have another problem to submit :
>
> Here is my bean
> <form-bean name="questionnaireForm"
> type="org.apache.struts.validator.DynaValidatorForm">
>       <form-property name="page" type="java.lang.Integer" initial="1"/>
>       <form-property name="firstName" type="java.lang.String" initial="Nom"
> />
>       <form-property name="lastName" type="java.lang.String" />
>      <form-property name="child" type="java.lang.String" initial="N"/>
>       <form-property name="numChild" type="java.lang.Integer" initial="0"/>
> </form-bean>
>
> where Personne is a class of two attributes {name,age} with their getters
> and
> setters.
>
> In my jsp, I try do do this :
>
> <bean:define id="numChild" name="questionnaireForm" property="numChild"
> type="java.lang.Integer"/>
> <c:forEach begin="1" end='<%=numChild.intValue()%>' var="ind">
> <bean:define name="ind" id="ind2" type="java.lang.Integer"/>
> <tr>
> <td><bean:write name="ind"/></td>
> <td><html:text property='<%="children["+(ind2.intValue()-1)+"].name"%>'
> size="30" maxlength="30"/></td>
> <td><html:text property='<%="children["+(ind2.intValue()-1)+"].age"%>'
> size="30" maxlength="30"/></td>
> </tr>
> </c:forEach>
>
> And i get this error :
> No getter method for property children[0].name of bean
> org.apache.struts.taglib.html.BEAN
>
> Following the Struts FAQ for Indexed properties, it seems it should work...
>
> Please tell me what I missed.
> Rémi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

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