Best way to add a “nothing selected” option to a selectOneMenu in JSF
Just explicitly set the select item value to null. <h:selectOneMenu value=”#{bean.selectedItem}”> <f:selectItem itemValue=”#{null}” itemLabel=”–select–” /> <f:selectItems value=”#{bean.availableItems}” /> </h:selectOneMenu> No, an empty string like itemValue=”” is not sufficient. It really has to be null. Otherwise you run into trouble as described in this Q&A: Using a “Please select” f:selectItem with null/empty value inside a p:selectOneMenu. … Read more