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 value of the selectOneChoice.

-Richard

On Tue, Sep 9, 2008 at 7:34 AM, tkazmierczak <[EMAIL PROTECTED]> 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:
>
> <tr:selectOneChoice label="Start year" value="1" required="true"
> valuePassThru="true">
>        <tr:forEach var="year" begin="0" end="10">
>                <tr:selectItem label="#{year}" value="#{year}" />
>        </tr:forEach>
> </tr:selectOneChoice>
>
> 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 an "empty" value and
> I get this error message in the server's output:
>
> 2008-09-09 15:54:23
> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectOneRenderer
> _getSelectedIndex
> WARNING: Could not find selected item matching value "1" in
> CoreSelectOneChoice[UIXEditableFacesBeanImpl, id=_idJsp9]
>
> What is wrong/missing in the code?
> I'm using Trinidad 1.0.7.
> --
> View this message in context: 
> http://www.nabble.com/default-value-in-tr%3AselectOneChoice-tp19393693p19393693.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Reply via email to