3 Replies Latest reply on Aug 30, 2010 9:06 AM by liuliu

    Problem with h:selectOneMenu and f:selectItems

    semua60

      Hello,

       

      I've a simple jsf form (richfaces 3.3.3) with component h:selectOneMenu and f:selectItems

       

      <h:form>
           <h:selectOneMenu id="aa" value="#{testBean.str}">
                 <f:selectItems id="bb" value="#{testBean.items}" />
           </h:selectOneMenu>

      </h:form>

       

       

      And the bean is:

       

      public class TestBean {

          private String str;

       

         public List<SelectItem> getItems() {

             List<SelectItem> items = new ArrayList();

             items.add(new SelectItem("a", "a1"));
             items.add(new SelectItem("b", "b1"));

             return items;

         }

       

          public String getStr() {

              return str;

          }

       

          public void setStr(String str) {

              this.str = str;

          }

      }

       

       

      When I run, I got error message:

      ....

      javax.servlet.ServletException: Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne ....

      .....

       

       

      But If I change f:selectItems with statically defined using f:selectItem, it's working properly.

       

      Anyone can help me? How to resolve this?

       

      Thanks,