I have a JSP containing a checklist -type form where I'm trying to present a list of employees and two checkboxes beside each name, where the checkboxes correspond to employee.check1 (boolean) and employee.check2 (boolean). I want to be able to scroll down the list of employees and check off box 1 and/or box 2 for each employee, hit Save (once) at the bottom and have it update each employee's record and set check1 and check2 accordingly. I have a viewChecklist.jsp and an editChecklist.jsp. Here is the display only list on viewChecklist.jsp:
On the editChecklist.jsp, I want something similar but with the checkboxes enabled. assuming I may need to switch from forEach (which iterates my session variable employeesForChecklist) to a logic:iterate ? The app uses Nitrox but not sure I need to use that here. I'm rusty with this stuff, creating a row index and how to build the array of employee IDs that need updating is just eluding me. Tips? Suggestions? Code samples? thanks in advance!!!
OK, I'm real close here. Using that FAQ link - which was VERY helpful, thanks! - I was able to get my checklist utility working. However, I have one minor quirk. The first time I ran it, all checkboxes were empty/false. Which was expected. I then went down and selectively checked a few records and they all set properly. Nice. However, UNchecking those checkboxes does not set the boolean back to false. When I step through the debugger, I see the iteration's row is showing TRUE for those checkboxes. My thought was that it was seeing null and I might need to explicity check for null and if so, set to false - but I cannot see a null coming in. All I see is true. My code is very closesly modeled after what's found in that FAQ page, so I won't paste it all here. Any thoughts on what I might need to add?
The red text is where I'm scratching my head. It works going false to true but I can't UNcheck the boxes to get back to false.
Greg C Robinson
Joined: Jan 30, 2009
One additional note to add: on my EmployeeForm, I do have a reset method where my boolean values get explicitly set to false. However, while this does get called and works fine for individual employee record updates, that reset method is NOT getting when using this checklist. the iteration is a collection of EmployeeForm beans, but the reset does not get referenced. I do not currently have a reset method in my ChecklistItemForm.