myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ernst Fastl" <ernst.fa...@gmail.com>
Subject Re: Question about creating a dropdown list with dynamic values
Date Tue, 31 Oct 2006 08:15:58 GMT
You could write a method:

List<SelectItem> retval = new ArrayList<SelectItem>();

for(A a:list)
  retval.add(new SelectItem(a.getAttr1() + a.getAttr2() ) )

return retval;

and use this as value for a selecItems-component

hope that helps

Ernst

On 10/31/06, ying lcs <yinglcs@gmail.com> wrote:
> i have a list of object , A. And object A has 2 string attributes: attr1, attr2.
>
> How can i create a dropdown select list by combining the string of
> attr1 and string of attr2?
>
> i.e. I want to create a select value option of
> [attr1, attr2]  // for each A in the list of A.
>
> Thank you for any help.
>

Mime
View raw message