You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Behrang Saeedzadeh <be...@gmail.com> on 2006/11/27 12:40:44 UTC

Binding a java.util.List to a selectOneMenu

Hi,

In a backing bean I have a set/get property called humanResources that
returns a java.util.List containing HumanResource instances. The
HumanResource class contains a few properties, three of them being
firstName, lastName, and userName.

I want to bind the humanResources list to a h:selectOneMenu component,
and I want each option of the menu to look like

  #{humRsrc.lastName}, #{humRsrc.firstName} (#{humRsrc.username})

Is it possible to assign the java.util.List to the h:selectOneMenu
component directly, without creating SelectItems in the backing bean?

Thanks in advance,
Behi

-- 
"Science is a differential equation. Religion is a boundary condition"
- Alan Turing

Behrang Saeedzadeh
http://www.jroller.com/page/behrangsa
http://my.opera.com/behrangsa

Re: Binding a java.util.List to a selectOneMenu

Posted by Behrang Saeedzadeh <be...@gmail.com>.
Oops! I just re-read the
http://myfaces.apache.org/sandbox/selectItems.html ... it's whole
purpose is to enable what I am looking for. Thanks again.

Regards,
Behi

On 11/27/06, Behrang Saeedzadeh <be...@gmail.com> wrote:
> Cagatay,
>
> Thanks for the response. Cagatay, what if I only wanted to display a
> simple property of the items in the list? Is there a way to do this
> without creating SelectItems in the backing bean? Just by directly
> binding the java.util.List<HumanResource> to the selectOneMenu? It is
> a little bit strange that the select...Menu components do not have a
> "var" attribute like the gang of the grids.?!?!
>
> Regards,
> Behi
>
> On 11/27/06, Cagatay Civici <ca...@gmail.com> wrote:
> > Hi Behrang,
> >
> > Extended selectitems in sandbox(will join tomahawk soon) will fit for this.
> >
> > http://myfaces.apache.org/sandbox/selectItems.html
> >
> >  Regards,
> >
> > Cagatay
> >
> >
> > On 11/27/06, Behrang Saeedzadeh <be...@gmail.com> wrote:
> > > Hi,
> > >
> > > In a backing bean I have a set/get property called humanResources that
> > > returns a java.util.List containing HumanResource instances. The
> > > HumanResource class contains a few properties, three of them being
> > > firstName, lastName, and userName.
> > >
> > > I want to bind the humanResources list to a h:selectOneMenu component,
> > > and I want each option of the menu to look like
> > >
> > >   #{humRsrc.lastName}, #{humRsrc.firstName} (#{humRsrc.username })
> > >
> > > Is it possible to assign the java.util.List to the h:selectOneMenu
> > > component directly, without creating SelectItems in the backing bean?
> > >
> > > Thanks in advance,
> > > Behi
> > >
> > > --
> > > "Science is a differential equation. Religion is a boundary condition"
> > > - Alan Turing
> > >
> > > Behrang Saeedzadeh
> > > http://www.jroller.com/page/behrangsa
> > > http://my.opera.com/behrangsa
> > >
> >
> >
>
>
> --
> "Science is a differential equation. Religion is a boundary condition"
> - Alan Turing
>
> Behrang Saeedzadeh
> http://www.jroller.com/page/behrangsa
> http://my.opera.com/behrangsa
>


-- 
"Science is a differential equation. Religion is a boundary condition"
- Alan Turing

Behrang Saeedzadeh
http://www.jroller.com/page/behrangsa
http://my.opera.com/behrangsa

Re: Binding a java.util.List to a selectOneMenu

Posted by Behrang Saeedzadeh <be...@gmail.com>.
Cagatay,

Thanks for the response. Cagatay, what if I only wanted to display a
simple property of the items in the list? Is there a way to do this
without creating SelectItems in the backing bean? Just by directly
binding the java.util.List<HumanResource> to the selectOneMenu? It is
a little bit strange that the select...Menu components do not have a
"var" attribute like the gang of the grids.?!?!

Regards,
Behi

On 11/27/06, Cagatay Civici <ca...@gmail.com> wrote:
> Hi Behrang,
>
> Extended selectitems in sandbox(will join tomahawk soon) will fit for this.
>
> http://myfaces.apache.org/sandbox/selectItems.html
>
>  Regards,
>
> Cagatay
>
>
> On 11/27/06, Behrang Saeedzadeh <be...@gmail.com> wrote:
> > Hi,
> >
> > In a backing bean I have a set/get property called humanResources that
> > returns a java.util.List containing HumanResource instances. The
> > HumanResource class contains a few properties, three of them being
> > firstName, lastName, and userName.
> >
> > I want to bind the humanResources list to a h:selectOneMenu component,
> > and I want each option of the menu to look like
> >
> >   #{humRsrc.lastName}, #{humRsrc.firstName} (#{humRsrc.username })
> >
> > Is it possible to assign the java.util.List to the h:selectOneMenu
> > component directly, without creating SelectItems in the backing bean?
> >
> > Thanks in advance,
> > Behi
> >
> > --
> > "Science is a differential equation. Religion is a boundary condition"
> > - Alan Turing
> >
> > Behrang Saeedzadeh
> > http://www.jroller.com/page/behrangsa
> > http://my.opera.com/behrangsa
> >
>
>


-- 
"Science is a differential equation. Religion is a boundary condition"
- Alan Turing

Behrang Saeedzadeh
http://www.jroller.com/page/behrangsa
http://my.opera.com/behrangsa

Re: Binding a java.util.List to a selectOneMenu

Posted by Cagatay Civici <ca...@gmail.com>.
Hi Behrang,

Extended selectitems in sandbox(will join tomahawk soon) will fit for this.

http://myfaces.apache.org/sandbox/selectItems.html

Regards,

Cagatay

On 11/27/06, Behrang Saeedzadeh <be...@gmail.com> wrote:
>
> Hi,
>
> In a backing bean I have a set/get property called humanResources that
> returns a java.util.List containing HumanResource instances. The
> HumanResource class contains a few properties, three of them being
> firstName, lastName, and userName.
>
> I want to bind the humanResources list to a h:selectOneMenu component,
> and I want each option of the menu to look like
>
>   #{humRsrc.lastName}, #{humRsrc.firstName} (#{humRsrc.username})
>
> Is it possible to assign the java.util.List to the h:selectOneMenu
> component directly, without creating SelectItems in the backing bean?
>
> Thanks in advance,
> Behi
>
> --
> "Science is a differential equation. Religion is a boundary condition"
> - Alan Turing
>
> Behrang Saeedzadeh
> http://www.jroller.com/page/behrangsa
> http://my.opera.com/behrangsa
>