This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
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 Soft Skills this week in the Jobs Discussion 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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data binding 2 variables to a checkbox