Mike Kienenberger wrote:
If I recall, one of the constructors does allow you to inconsistently
pass in a null.

Unfortunately not, at least in 1.1.1 (the version I'm currently using); the only constructor that doesn't have the check is the no-args constructor :-)

And in JSF 1.2, I just saw a change-request go through to allow nulls.

Ah, so this is a spec-enforced limitation?

However, I use a flag value.

[...]

In my (auto-generated) converters,

[...]

That works, provided you're willing to define a converter for every use of select items... I'd rather avoid having to add a bunch of converters just to allow this :-( Unfortunately, it sounds like the only way to do that may be to write a custom component, which seems a bit crazy...

I'll have a look at whether there's support for this in Tomahawk or Trinidad first, though.

L.



On 8/12/06, Laurie Harper <[EMAIL PROTECTED]> wrote:
How do I create an 'empty' SelectItem? I'd like to present a
selectOneChoice which allows the target model value to be set to 'null'.
But I can't create a 'null' SelectItem:

   SelectItems[] items = new SelectItems[] {
     new SelectItem(null, "(none)"),
     new SelectItem(1, "one"),
     ...
   };

The SelectItems constructor has an explicit check for a null value or
label. Short of inventing a 'flag' value for every option list and using
a custom converter to translate it back to 'null' during apply values,
how do I get an 'empty' item in my SelectItems array?

L.




Reply via email to