• 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Data binding 2 variables to a checkbox  RSS feed

 
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!