You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Mike Kienenberger <mk...@gmail.com> on 2005/07/20 20:43:27 UTC

using SelectItem with a null value

I notice that both the JSF 1.2 RI and MyFaces throw
NullPointerExceptions if you try to construct a SelectItem with a null
object value.   Why?   Null is ideal for specifying a "nothing
selected" selection.

Worse, you can bypass the check simply by doing

item = new SelectItem();
item.setLabel("Select an option")

instead of

item = new SelectItem(null, "Select an option"))

-Mike