7 Replies Latest reply on May 16, 2011 12:10 AM by P18Mar ch ;)

    How to use dropDown (selectItems) with class values in JSF

    er.viveksrivastava Newbie

      Hello to all,

       

      I am expert in jsf

      but I get a little problem can YOU solve it

       

       

      I am getting problem to show dropDown values in JSF

      In handler I have a arraylist Of  a dummy class type now this arraylist of size 10  store only 1 string per subscript.

      How can i show these values in my JSF form in drop down  selectItems

       

      How can I convert it into selectItems as in jsf

       

       

      -------------------------------DAO

       

      FileTemplateDao fileTemplateDao = new FileTemplateDao();

              gcFileFieldBo = (ArrayList<GcFileFieldBo>) fileTemplateDao.getFileFieldList();

       

      ---------------------------------JSF

       

      <h:selectOneMenu id="fieldName12" style="width: 220px;"

                              required="true" value="#{fileTemplateHandler.selFieldId}"

                              styleClass="selectOneMenu" >

                              <f:selectItem itemValue="#{fileTemplateHandler.defFileId}"

                                  itemLabel="Select Field" />

                              <f:selectItems value="#{fileTemplateHandler.gcFileFieldBo}" />

                          </h:selectOneMenu>

      _________________________________

       

       

       

       

      javax.servlet.ServletException: Argument Error: An option for component fieldName12 was not an instance of javax.faces.model.SelectItem.  Type found: java.util.ArrayList.

       

       

       

      Please Help me I am totally frustated.