webtier@glassfish.java.net

Permit empty/no/null selection in h:selectOneMenu

From: <webtier_at_javadesktop.org>
Date: Thu, 26 Aug 2010 03:18:43 PDT

This may be so obvious I'm just looking right past it, but, in JSF2 (Mojarra, Glassfish 3.0.1):

If I have a h:selectOneMenu control in a JSF2 page with a value bound to a List<SomeDomainType>, is there any way to permit an empty/null selection? The menu defaults to having the first item selected when it's rendered, and doesn't have any blank or placeholder first row, even if required=false .

I can insert a dummy value in the list and alter my FacesConverter to handle it, but that seems awfully ugly for something that's a pretty basic piece of functionality. Is there some simple way I'm missing?
[Message sent by forum member 'ringerc']

http://forums.java.net/jive/thread.jspa?messageID=481055