Re: default value in tr:selectOneChoice

2008-10-15 Thread tkazmierczak
Unfortunately this didn't help. But this helps: Rafa Pérez wrote: > > Try changing > >> >> >> > > for: > > > > And in the bean add (with its getter and setter): > > private SelectItem[] selectItemArray; > > >

Re: default value in tr:selectOneChoice

2008-10-15 Thread tkazmierczak
I'm using Java 6. But maybe the problem is caused by the fact that the version of JSF I'm using is 1.1? Anyway, I cannot upgrade to a higher version. But I've found a solution - instead of adding the tr:selectItem tags using tr:foreach, I just hardcoded the list of tr:selectItem tags into the jspx

Re: default value in tr:selectOneChoice

2008-09-24 Thread Richard Yee
I'm guessing that you are using java 5 and the year variable is getting autoboxed to an Integer object in the selectItem. I suggest that you create the list of selectItems in the backing bean, have a getter for the list, and use the f:items tag to retrieve the list. Make sure the type you use

Re: default value in tr:selectOneChoice

2008-09-24 Thread tkazmierczak
Richard Yee-3 wrote: > > As I mentioned in my prior email, you need to set the value attribute > in the tr:selectOneChoice tag to be an el expression that resolves to > a property in a backing bean. > > ie. value="#{myBacking.selectVal}" > > selectVal would be defined as a String and would hav

Re: default value in tr:selectOneChoice

2008-09-17 Thread Richard Yee
As I mentioned in my prior email, you need to set the value attribute in the tr:selectOneChoice tag to be an el expression that resolves to a property in a backing bean. ie. value="#{myBacking.selectVal}" selectVal would be defined as a String and would have a getter and setter. To select a defau

Re: default value in tr:selectOneChoice

2008-09-17 Thread Rafa Pérez
Try changing > > > for: 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())

Re: default value in tr:selectOneChoice

2008-09-17 Thread tkazmierczak
This seems to help, but partially - the form indeed has now the value set to 1, but it is no longer a combobox, but rather an outputText. I think that this is caused by the fact that when you set the value this way (value="#{1}") then it is read-only. Stephen Friedrich-4 wrote: > > Just a guess

Re: default value in tr:selectOneChoice

2008-09-17 Thread tkazmierczak
Ok, now my code looks like this: the bean.initialValue is set to 1 in the declaration of the member (private int initialValue = 1;) but this doesn't help. I get such warning: 2008-09-17 11:08:18 org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.Simple

Re: default value in tr:selectOneChoice

2008-09-09 Thread Stephen Friedrich
Just a guess: Try value="#{1}" tkazmierczak wrote: Hello, I've searched half of the Internet, but haven't found an answer to my question. I create a tr:selectOneChoice this way: and want the resulting HTML combobox to have the value with label "1" set by d

Re: default value in tr:selectOneChoice

2008-09-09 Thread Richard Yee
You should have the value attribute in the selectOneChoice be an EL expression that references a field in your backing bean. If you do this and set the value of the field to "1" when the bean is created, it will be defaulted as you expect. With your current code, there is no way of submitting the v

default value in tr:selectOneChoice

2008-09-09 Thread tkazmierczak
Hello, I've searched half of the Internet, but haven't found an answer to my question. I create a tr:selectOneChoice this way: and want the resulting HTML combobox to have the value with label "1" set by default, but what I get is that the combobox is set to