aspose file tools*
The moose likes JSF and the fly likes selectOneRadio problem 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 "selectOneRadio problem" Watch "selectOneRadio problem" New topic

selectOneRadio problem

Ian Dunsirn
Ranch Hand

Joined: May 25, 2006
Posts: 36
I am having some troubles with radio buttons. Here is my code:

<h:selectOneRadio id="commentOrder" value="{#prjsys.oldestCommentFirst}">
<f:selectItem itemLabel="Newest First" itemValue="false"/>
<f:selectItem itemLabel="Oldest First" itemValue="true"/>

The item in the bean (prjsys.oldestCommentFirst) is set to true. I expect that when I call my page, the radio button for "Oldest First" should be filled in. However, when I actually do call the apge, nothing is selected. How can I get the jsf to fill in the appropriate button based on the value stored in prjsys.oldestCommentFirst?
Piotr Swiecicki

Joined: Nov 16, 2006
Posts: 17
try fixing EL expression - it should be:
Ian Dunsirn
Ranch Hand

Joined: May 25, 2006
Posts: 36
I made that correction and it still is not working.
Ian Dunsirn
Ranch Hand

Joined: May 25, 2006
Posts: 36
I found a way around it for now. It would appear that prjsys.oldestCommentFirst needs to be a String before the radio buttons will work like I wanted.
I agree. Here's the link:
subject: selectOneRadio problem
Similar Threads
Nest the selectOneRadio Under the selectManyCheckbox
How to make one of the Radio button default selected
How to select one Radio button by default.
h:selectOneRadio automatically creates Table