Rémi-
Which version JSTL are you implementing with?
Bon Chance,
Martin-
----- Original Message ----- From: "Dewitte Rémi" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Friday, July 01, 2005 11:36 AM
Subject: Re: deal with nested properties


Thanks a lot. More precisely, i must do this to get it work !
  <td><bean:write name="ind"/></td>
because <c:out value="${ind}"/> gives me $ind}
  <td><html-el:text  property="children[${ind}].nom"/></td>
  <td><html-el:text property="children[${ind}].age"/></td>


Le Vendredi 1 Juillet 2005 14:01, Wendy Smoak a écrit :
From: "Dewitte Rémi" <[EMAIL PROTECTED]>

> 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"/>
>       <bean:write name="ind"/>
>        <html:text
> property='<%="children["+(ind2.intValue()-1)+"].name"%>' size="30"
> maxlength="30"/>
> <html:text > property='<%="children["+(ind2.intValue()-1)+"].age"%>'
>                        size="30" maxlength="30"/>
> </c:forEach>

I took out the table tags and reformatted a bit.

Where are the form tags?  <html:text> only works inside a <html:form>.
Assuming you just left them out...

I don't think this will be exactly right, but maybe it will give you an
idea.  (I don't actually use indexed properties in my projects, but I
*think* this is how it's supposed to work... )

<c:forEach begin="0" end="${questionnaireForm.numChild}" var="ind">
   <c:out value="${ind}"/>
   name: <html-el:text property="${children[ind].name}"/>
   age: <html-el:text property="${children[ind].age}"/> <br/>
</c:forEach>

(I note that you added
   <form-property name="children" type="net.gide.webapp.Personne[]"/>
to the form in a later message, which I was going to mention is necessary.)

Consider switching to Struts-EL and JSTL so that you're not mixing the
'classic' tags which have JSTL equivalents. (For example, use <c:set>
instead of <bean:define> if you need it.)  Look in the 'contrib' directory
for Struts-EL.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to