Reputation: 329
I have this form on which I would like to create a dynamic number of dropdowns. I have a list of uncategorized applications which I would like each to have its own dropdown to select its category. I am not sure how to pass the unique data to the server. The dropdown options will be the same for each.
<html:form action="/CategorizeApps.do">
<h3>Uncategorized</h3>
<br/>
Categorize each application using the dropdown menu then click categorize.<br/>
<table class="list">
<thead>
<tr class="controls">
<td><input type="submit" name="btnAction" value="Categorize"/></td>
</tr>
<tr class="fields">
<td>ID</td>
<td>Name</td>
<td></td>
</tr>
</thead>
<tbody>
<logic:iterate id="uncat" name="appsUncat" scope="session">
<tr class="hlist">
<td><bean:write property="id" name="uncat" scope="page"/></td>
<td><bean:write property="name" name="uncat" scope="page"/></td>
<td>
<select id="category" name="category">
<logic:iterate id="categories" name="Categories" scope="session">
<option value="<bean:write name="categories" property="id" scope="page"/>"><bean:write name="categories" property="name" scope="page"/></option>
</logic:iterate>
</select>
</td>
</tr>
</logic:iterate>
</tbody>
</table>
</html:form>
Upvotes: 1
Views: 523
Reputation: 966
Once u choose the value then it will pass to Form(category) and set it in Category. Its done by struts it self. But you should use same Name or Id for value and Option. Or set your drop down value to select value.
Upvotes: 1