• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sagar Kale
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should do something like the following:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic