Since there are no "indexed" and "property" attributes for the <s:textfield> tag. So, I tried this:
<s:iterator value="names" id="name"> <s:textfield id="name" name="firstname" label="First Name"> <s:textfield id="name" name="lastname" label="Last Name"/> </s:iterator> Then, Struts 2 generated this: <tr> <td class="tdLabel"><label for="name" class="label">First Name:</label></td> <td ><input type="text" name="firstname" value="Campbell" id="name"/> </td> </tr> <tr> <td class="tdLabel"><label for="name" class="label">Last Name:</label></td> <td ><input type="text" name="lastname" value="" id="name"/> </td> </tr> Thanks, Willa ----- Original Message ---- From: Laurie Harper <[EMAIL PROTECTED]> To: user@struts.apache.org Sent: Wednesday, April 11, 2007 3:35:15 PM Subject: Re: [S2] Iterator and Index Minerva CC wrote: > Hi, > > I want to generate indexed html elements via iterator. In Struts 1, I would > do it as follows: > > <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 it? 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). L. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ____________________________________________________________________________________ Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. http://tools.search.yahoo.com/toolbar/features/mail/