aspose file tools*
The moose likes Spring and the fly likes List of checkboxes and Array/ArrayList data binding not working. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "List of checkboxes and Array/ArrayList data binding not working." Watch "List of checkboxes and Array/ArrayList data binding not working." New topic
Author

List of checkboxes and Array/ArrayList data binding not working.

Sagar Kale
Ranch Hand

Joined: May 02, 2008
Posts: 188
Hi,

I have a form in which I show list of empId, first name and last name in table form. I want to show checkbox in front of every row and I have Delete button, which when clicked should delete all the employees which are checked.
I tried a lot to bind list of checkboxes to array or ArrayList of empIds. But it does not properly bind it.






When I submit the form, in my form handler I get zero sized empIds list, even though I have checked few checkboxes.

I have tried <form:checkbox /> tag. It bindes, but the chckboxes which are not selected also get submitted with null values. In my code I ignore null, but the problem with tag is I could not find how to show unchecked checkboxes in my first display.
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
You should do something like the following:


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: List of checkboxes and Array/ArrayList data binding not working.