• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create default value for radio button

 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to check one of the radio button below as default value.. How do I do that in JSF. For example I owuld like to check/select Pass as default value. Thanks.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18281
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might like to change your display name to "Gopu Lilly".

However, in answer to your question, your problem lies in that you've defined a hardcoded display. In real life, you'd normally be setting the display from a backing bean and probably setting the backing bean from the display as well.

Like so:

The default value would be whichever value you'd initialized carBean.currentCar to. I've copied an example that uses the selectItems tag instead of individual selectItem's, but operation is identical.

Here's a good place for JSF tag usage examples:

http://www.exadel.com/tutorial/jsf/jsftags-guide.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic