• Post Reply Bookmark Topic Watch Topic
  • New Topic

Many check box daynamics  RSS feed

 
hassan ali
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

how can i have Many check box dynamically

in jsp

it was loop around <input TYPE=checkbox name=accommodation VALUE=Rugby> tag


according to result from search in database in table accommodation




how this can be done in JSF?
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest general-purpose way is to create a model class which contains a boolean property to capture the UI state, build up a List of those model objects (table rows), wrap it in a ListDataModel, then present the checkboxes as a dataTable:


I don't guarantee the above is 100% correct, but that's the general Idea.

Another, simpler way can be used if you just want a straight-up list of checkboxes arranged horizontally or vertically. Use the "selectManyCheckbox" control and create a list of SelectItems containing the checkbox captions and the values that will be inserted into the selectManyCheckbox value list when the corresponding item is checked.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!