Java Mailing List Archive

http://www.junlu.com/

Home » users.myfaces »

Re: default value in tr:selectOneChoice

tkazmierczak

2008-10-15

Replies: Find Java Web Hosting

Author LoginPost Reply

Unfortunately this didn't help.

But this helps:

      <tr:selectItem label="2008" value="2008" />
      <tr:selectItem label="2009" value="2009" />
      <tr:selectItem label="2010" value="2010" />
      <tr:selectItem label="2011" value="2011" />


Rafa Pérez wrote:
>
> Try changing
>
>>     <tr:forEach var="year" begin="#0" end="10">
>>           <tr:selectItem label="#{year}" value="#{year}" />
>>     </tr:forEach>
>
> for:
>
> <f:selectItems value="#{bean.selectItemArray}" />
>
> And in the bean add (with its getter and setter):
>
> private SelectItem[] selectItemArray;
>
>
> Then, to load the array you just have to do:
>
> selectItemArray = new SelectItemArray[1];
>
> selectItemArray[0] = new SelectItem(year, year.toString());
>
>
> HTH
>

--
Sent from the MyFaces - Users mailing list archive at Nabble.com.

©2008 junlu.com - Jax Systems, LLC, U.S.A.