• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

How to create default value for radio button

 
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 26294
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic