JSF SelectOneMenu with Nothing Selected

To add “nothing selected” to a dynamic h:selectOneMenu you can use the noSelectionOption=”true” attribute like this:

<h:selectOneMenu value="#{myBean.someItem}">
    <f:selectItem itemLabel="---" noSelectionOption="true" />
    <f:selectItems value={myBean.items}" />
</h:selectOneMenu>

 

 

Leave a Reply