Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
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.
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should do something like the following:
 
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic