wood burning stoves 2.0*
The moose likes JSF and the fly likes How to create default value for radio button    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to create default value for radio button    " Watch "How to create default value for radio button    " New topic

How to create default value for radio button

Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
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

Joined: Jun 25, 2001
Posts: 15640

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:


Customer surveys are for companies who didn't pay proper attention to begin with.
wood burning stoves
subject: How to create default value for radio button
Similar Threads
Nest the selectOneRadio Under the selectManyCheckbox
selectOneRadio problem
How to make one of the Radio button default selected
Adding space between Radio button and Label