| Author |
Handling Multiple check boxes
|
Sreek Gupta
Greenhorn
Joined: Mar 08, 2006
Posts: 24
|
|
Hi, I have a Collection of value objects(say Employee(Id, name, dateOfBirth,valid etc..). One Action sets the collection in session and forwards to a JSP that displays a list of Employees using <logic:iterate> over this collection. On each row of Employee information, one checkbox is provided to select whether employee is valid or not. Now if I select multiple checkboxes and submit the form(in JSP), I need the ActionForm to have a Collection that has Employee value objects. For this i declared String[] getters and setters for all the fields. Unfortunately i couldnt get unchecked values in my action form. How can i get all the entries (whether it is checked or unchecked). Please help me with code samples if possible. Regds, Sreek
|
 |
Alana Sparx
Ranch Hand
Joined: Feb 14, 2006
Posts: 121
|
|
I think there is a solution involving the struts multibox control. Your action form needs to declare 2 arrays - one to hold the entire collection of choices, and one to store the 'checked' choices. Summat along the lines of I *think* that's how it's done. I'll leave you to find out about re-setting the array!! As!
|
 |
 |
|
|
subject: Handling Multiple check boxes
|
|
|