aspose file tools*
The moose likes Other Application Frameworks and the fly likes Data binding 2 variables to a checkbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Data binding 2 variables to a checkbox" Watch "Data binding 2 variables to a checkbox" New topic
Author

Data binding 2 variables to a checkbox

Meghna Bhardwaj
Ranch Hand

Joined: Jun 08, 2007
Posts: 109
Dear experts,

I hope someone can help me out with data binding to a checkbox. I am showing a list of "Persons" with 5 attributes each (such as name, role, Phone, email, dateJoined), each having a checkbox beside it. User can select 1 person and submit the form for processing.

I am currently binding the PersonId to the checkbox as below:

This works fine and I am able to see the personId in the Controller depending on what the user ticks. My challenge is that I would like to bind personId and role attribute to the checkbox. Does anyone know what the syntax is for the above <spring:bind > tags when binding the same checkbox to another attribute which is also present in the jsp?

I have added in my Command bean the instance variables personId and role, and also have getters/setters for them. I just don't know how the jsp can pass the second attribute depending on the checkbox that is ticked. I did try some variations of this syntax to try and bind the checkbox to role also, but have been unsuccessful so far.

Any help will be greatly appreciated!

Many thanks.
 
 
subject: Data binding 2 variables to a checkbox
 
Similar Threads
Help with jstl forEach spring 2.0 binding
Spring and Filtering
bringing up simple form in spring
JSTL without el to bind in spring
need help :: multiple rows update without primary key