Hi All,
I currently upgrading from struts 1.x to struts 2 and have come into some difficulty with a dynamic page full of checkboxes.
In my original code I had a bean (productList) which contained the following: catalogueNumber, Description, title, +others used in the display. I also had a String array (selectedItems ) of all the pre-selected items that needed to be checked. now on my jsp I had the following code
As you can see I would loop through all the products in the productList and the multibox tag would then write out the checkbox and check it if required. When submitting the form I would then examine selectedItems which would produce and array of catalogue numbers that have been selected.
Can anyone help me on the syntax for using checkbox / checkboxlist to product the same result as what I was getting above. I'm totally lost at the moment.
Thanks
Zapster
I currently upgrading from struts 1.x to struts 2 and have come into some difficulty with a dynamic page full of checkboxes.
In my original code I had a bean (productList) which contained the following: catalogueNumber, Description, title, +others used in the display. I also had a String array (selectedItems ) of all the pre-selected items that needed to be checked. now on my jsp I had the following code
Code:
<c:forEach items="${productlist}" var="prod" >
<tr>
<td>
<div class="productcatnum"><c:out value="${prod.catalogueNumber}" /></div>
<div class="producttitle"> <c:out value="${prod.Description}" /></div>
<div class="productaction">
<html:multibox property="selectedItems" >
<c:out value="${prod.product.catalogueNumber}" />
</html:multibox>
</div>
</td>
</tr>
</c:forEach>
As you can see I would loop through all the products in the productList and the multibox tag would then write out the checkbox and check it if required. When submitting the form I would then examine selectedItems which would produce and array of catalogue numbers that have been selected.
Can anyone help me on the syntax for using checkbox / checkboxlist to product the same result as what I was getting above. I'm totally lost at the moment.
Thanks
Zapster