I use the <h:selectOneRadio>
component in JSF2 to create radiobuttons. One is "Yes" and another one "No". Note that I cannot use a checkbox here.
In my backing bean I have a boolean
property. When "yes" is selected, I want that boolean to be true
and when "no" is selected I want it to be false
. How can I achieve this?
This doesn't do it:
<h:selectOneRadio value="#{bean.bool}">
<f:selectItem itemValue="false" itemLabel="Yes" />
<f:selectItem itemValue="true" itemLabel="No" />
<f:ajax event="change" render="theDiv" />
</h:selectOneRadio>
<h:panelGroup layout="block" id="theDiv" rendered="#{bean.bool}">
....
</panelGroup>