Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Struts 2 multibox to checkboxlist help

Status
Not open for further replies.

zapster

Programmer
Jun 8, 2001
36
GB
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
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top