Try the below logic:
Use s:set for generating index
<s:set name="index" value="0"/>
<s:iterator status="sts" value="mylist">
<s:textfield name="mylist[${index}].dstn"/>
<s:set name="index" value="${index+1}"/>
</s:iterator>
-Nishi.
EoneZhang wrote:
>
> Hi, everyone.
>
> I have something wrong about the usage of struts tag and OGNL.
>
> Here is my problem:
>
> I want to generate the following html with <s:textfiled/> tag:
>
>
> <input name="mylist[0].dstn" value="CNS" type="text"><br/>
> <input name="mylist[1].dstn" value="CNS" type="text"><br/>
> <input name="mylist[2].dstn" value="CNS" type="text"><br/>
>
>
> I use the tag like following:
>
>
> <s:iterator status="sts" value="mylist">
> <s:textfield name="mylist[#sts.index].dstn"/>
> </s:iterator>
>
>
> But it generate the below html:
>
>
> <input type="text" name="mylist[#sts.index].dstn" value="CNS"
> id="list_mylist__sts_index__dstn"/>
> <input type="text" name="mylist[#sts.index].dstn" value="CNS"
> id="list_mylist__sts_index__dstn"/>
> <input type="text" name="mylist[#sts.index].dstn" value="CNS"
> id="list_mylist__sts_index__dstn"/>
>
>
> Is there anyone who can give some help,thanks a lot:handshake:
>
>
>
>
>
>
--
View this message in context:
http://www.nabble.com/-HELP-%3A-struts-tag-and-OGNL-tp20653798p20677591.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]