struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <>
Subject Re: [S2] Iterator and Index
Date Wed, 11 Apr 2007 22:35:15 GMT
Minerva CC wrote:
> Hi,
> I want to generate indexed html elements via iterator. In Struts 1, I would do it as
> <logic:iterate name="namesForm" property="names" id="name">
>     <html:text name="name" property="firstname" indexed="true" size="30"/>
>     <html:text name="name" property="lastname" indexed="true" size="30"/>
> </logic:iterate>
> Then Struts 1 will generate the output like this:
> <input type="text" name="name[0].firstname" size="30" value="">
> <input type="text" name="name[0].lastname" size="30" value="">
> <input type="text" name="name[1].firstname" size="30" value="">
> <input type="text" name="name[1].lastname" size="30" value="">
> .... 
> Now,  how can I do the same with Struts 2? I tried <s:iterator> and <s:textfield>.
But, they don't have have equivalent attributes. Is there anyone who has an idea how to do

What did you try? s:iterator and s:textfield seem like the right pair of 
tags to use. I think Struts 2 will take care of the property indexing 
for you automatically (could be wrong on that though).


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message