Hi,

How would you go about rendering a form containing multiple instances of, 
say, address in a JSP?  The following code works fine for us only if we 
know in advance how many addresses there are.  If use the <logic:iterate > 
tag to render a collection of addresses, we lose the benefit of getting the 
updated addresses populated to the action form automatically by Stuts at 
form submission.  Please advise.  Thanks.


<table>
        <tr>
                <th align="right">Address</th>
                
                <td align="left">
                        <html:hidden property="address[0].addressTkey"/>
                        <html:select property="address[0].addressTypeTkey">
                                        <html:options collection="addressTypes" 
property="value" 
labelProperty="label"/>
                        </html:select>
                        <html:text property="address[0].street1" size="25" 
maxlength="40"/>
                        <html:text property="address[0].street2" size="25" 
maxlength="40"/>
                        <br>
                        City<html:text property="address[0].city" size="15" 
maxlength="30"/>
                        State<html:text property="address[0].state" size="2" 
maxlength="4"/>
                        Zip<html:text property="address[0].zip" size="5" 
maxlength="15"/>
                        Country<html:text property="address[0].country" size="10" 
maxlength="30"/>
                </td>
        </tr>
                
        <tr>
                <th align="right"></th>
                
                <td align="left">
                        <html:select property="address[1].addressTypeTkey">
                                        <html:options collection="addressTypes" 
property="value" 
labelProperty="label"/>
                        </html:select>          
                        <html:hidden property="address[1].addressTkey"/>
                        <html:text property="address[1].street1" size="25" 
maxlength="40"/>
                        <html:text property="address[1].street2" size="25" 
maxlength="40"/>
                        <br>
                        City<html:text property="address[1].city" size="15" 
maxlength="30"/>
                        State<html:text property="address[1].state" size="2" 
maxlength="4"/>
                        Zip<html:text property="address[1].zip" size="5" 
maxlength="15"/>
                        Country<html:text property="address[1].country" size="10" 
maxlength="30"/>
                </td>
        </tr>
</table>


Reply via email to