4 Replies Latest reply on Jun 21, 2013 6:02 PM by Brian Leathem

    rich:pickLis dose not accept f:selectItems value as object

    Mohammad Weshah Novice


      i have a rich:picklist and inisde it f:selectItems the value for selectItems is an object of the same type of the value of rich:picklist , the problem nothing happen when i press the action button i.e(the value for the rich:pickList dose not set to the selected objects if i select any object and the action method dose not fire ) , i changed the code as the following to fire the action:

      - change rich:pickList value to the List of Integer

      - and change f:selectItems value to the List of Integer

      - and in the action methos process the intger values and populate a list of my object


      why the rich:pickList dose not work with f:selectItems object value not integer




        • 1. Re: rich:pickLis dose not accept f:selectItems value as object
          Siva P Master

          you are using selectitem of jsf so its object type should be select item of list,not as integer.



                                                      <rich:pickList id="pickListPanel"





                                                          moveControlsVerticalAlign="middle" listsHeight="400px"

                                                          style="marigin-left:-2px;" sourceListWidth="250px"




                                                              value="#{updateAttendanceHome.empNominatedList}" />

                                                          <a4j:support event="onlistchanged" ajaxSingle="true" />


                                                      <rich:message id="picklist" for="pickListPanel">







          public List<SelectItem> getNominatedEmployeeList() {


          ----------------------------------------- UR code -----------------------


                  Employee emp;

                  String name;

                  Long eid;


                  while (updatedGapIte.hasNext()) {

                      trainingplanhistory = updatedGapIte.next();

                      emp = trainingplanhistory.getEmployee();

                      name = emp.getName();

                      eid = emp.getEid();


                      SelectItem val = new SelectItem(name + " - " + eid);




                  return empNominatedList;



          Sure it will load the data in the picklist and works fine........

          • 2. Re: rich:pickLis dose not accept f:selectItems value as object
            Mohammad Weshah Novice

            i know if i add value as primitive it will works but in my case the value it should be Object of my bean , i think i ahve to do it with converter .

            • 3. Re: rich:pickLis dose not accept f:selectItems value as object
              Siva P Master

              Please have a look on here for <f:selectItems>,




              you can also use like below if you use s:selectItems,It depends on your project setup and implementation



              <s:selectItems value="#{participantGroupEmployeeMappingHome.empList}" var="empName"

              label="#{empName.name} - #{empName.eid}"/>



                   * @param empList the empList to set


                  public void setEmpList(List<Employee> empList) {

                      this.empList = empList;





                   * @return the empList


                  public List<Employee> getEmpList() {

                      return empList;



              Convertor like:


              public Object getAsObject(FacesContext arg0, UIComponent arg1, String value)


                      // TODO Auto-generated method stub

                      Long conversionString = Long.parseLong(value);       

                      return mapValue.get(conversionString);                



                  public String getAsString(FacesContext arg0, UIComponent arg1, Object value)


                      // TODO Auto-generated method stub

                      mapValue.put(((Employee) value).getEid(), (Employee) value);

                      return ((Employee) value).getEid().toString();          



              You can alos use seam convert entity by default,


              <s:selectItems value="#{emptrainingrolemappingHome.trainingRolesSelectItemList}" var="role"



              • 4. Re: rich:pickLis dose not accept f:selectItems value as object
                Brian Leathem Master

                Yes, a converter is required for the picklist to work with Objects.