0

When I click submit button in a jsf page I get the above error.

html:

             <h:selectOneMenu id="ddlCountryCode" value="#{jsfFills.countries}">
                <f:selectItems value="#{jsfFills.countries}" var="c"
                               itemLabel="#{c.CName}" itemValue="#{c.CCode}" />
            </h:selectOneMenu>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Abdul Gafoor M
  • 107
  • 1
  • 3
  • 9

1 Answers1

1

The "value" attribute should point to a variable where you want to store the selected value of the component, not the list of choices.

In the example above, jsfFills.countries is used as both the list of options AND the value of the component, and that could be causing the issue. We'd want to create a variable in a bean somewhere and use that instead.

        <h:selectOneMenu id="ddlCountryCode" value="#{jsfFills.selectedCountry}">
            <f:selectItems value="#{jsfFills.countries}" var="c"
                           itemLabel="#{c.CName}" itemValue="#{c.CCode}" />
        </h:selectOneMenu>
Ali Cheaito
  • 3,746
  • 3
  • 25
  • 30