Hi,

Another solution will be;

<h:selectOneMenu value="#{SomeBean.someVariable}">
                    <f:selectItem itemLabel="" itemValue=""/>
                    <f:selectItems value="#{ SomeBean.selectItemCollection}"/>
</h:selectOneMenu>

Cagatay

On 8/12/06, Glauco Pimentel Gomes < [EMAIL PROTECTED]> wrote:
You can do this:

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

Glauco P. Gomes

Laurie Harper escreveu:
> 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.
>>>
>>>
>>
>
>



_______________________________________________________
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora!
http://br.mobile.yahoo.com/mailalertas/



Reply via email to