This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Data binding 2 variables to a checkbox  RSS feed

 
Meghna Bhardwaj
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!