Meaningless Drivel is fun!*
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
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
Author

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: 15957
    
  19

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


Customer surveys are for companies who didn't pay proper attention to begin with.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to create default value for radio button
 
Similar Threads
Adding space between Radio button and Label
selectOneRadio problem
Radio
How to make one of the Radio button default selected
Nest the selectOneRadio Under the selectManyCheckbox