Reputation: 1708
I want to render a panelgroup only if the value of my selectOneMenu is not null. I have this:
<h:selectOneMenu value="#{bean.myString}">
<f:selectItem itemValue=#{null} itemLabel="None" />
<f:selectItem itemValue="first" itemLabel="First" />
<f:selectItem itemValue="second" itemLabel="Second" />
<f:ajax render="panelWrap" />
</h:selectOneMenu>
<h:panelGroup id="panelWrap">
<h:panelGroup rendered="#{bean.myString == null ? false : true}">
// My content
</h:panelGroup>
</h:panelGroup>
I did this a lot with objects but here I am stuck on a simple string value. Can anybody help? Thanks
Upvotes: 0
Views: 11171
Reputation: 6568
On your first <f:selectItem>
change itemValue=#{null}
to itemValue="#{null}"
. In your second panelGroup
change the rendered condition to "#{not empty bean.myString}"
. You might find this link helpful.
Evaluate empty or null JSTL c tags
Upvotes: 2