Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

selectOneRadio problem

 
Ian Dunsirn
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"/>
</h:selectOneRadio>

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
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try fixing EL expression - it should be:
#{prjsys.oldestCommentFirst}
 
Ian Dunsirn
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made that correction and it still is not working.
 
Ian Dunsirn
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic