4 Replies Latest reply on May 12, 2010 4:16 AM by beornotobe

    how to retrieve selected items in a picklist

      Hi everybody, i'm a newbie in richfaces, i have a problem to retrieve selected items in a picklist

      this is the code of jsp :

       

                                         <rich:pickList  value="#{configurePlansTarifaires.chosenListParamIN}">                       
                                                  <f:selectItem itemLabel="Type Modem" itemValue="modem"/>
                                                  <f:selectItem itemLabel="Région" itemValue="region"/>
                                              </rich:pickList>

      an a4j commandbouttin to retrieve selectedItems and process the results

                                    <a4j:commandButton id="confirmboutton" value="Valider" styleClass="boutonStandard" type="submit"                                                        actionListener="#{configurePlansTarifaires.parametrerIN}" >
                                              </a4j:commandButton> 
                           


      in my backing bean i create a list of String with getters and setters :

       

                                         private List<String> chosenListParamIN = new ArrayList<String>();

       

      when i try to retrieve results

                                         public void parametrerIN(ActionEvent event)
                                              {
                                                       if(chosenListParamIN().isEmpty())
                                                       {
                                                           System.out.println("Empty");
                                                            }    

                                                   }

      it's allways empty i don't know why

       

      is anyone have an idea please, i need help

        • 1. Re: how to retrieve selected items in a picklist
          zelenka

          I would reccomend to use action - <a4j:commandButton ...... action="#{configurePlansTarifaires.parametrerIN}"

          • 2. Re: how to retrieve selected items in a picklist

            thanks for reply, but even with action, the list is allways empty

            • 3. Re: how to retrieve selected items in a picklist

               

              that's a new track, my picklist is defined inside an a4j:outputpanel

                                                <a4j:outputpanel id="tarifparameters"> 

                                                  <rich:pickList   value="#{configurePlansTarifaires.chosenListParamIN}">                        
                                                          <f:selectItem  itemLabel="Type Modem" itemValue="modem"/>
                                                           <f:selectItem itemLabel="Région" itemValue="region"/>
                                                       </rich:pickList>

                                            </a4j:outputpanel>

               


              and my commandbutton is outside outputpanel, i find that when i make my picklist outside the outputpanel it's works fine.

               

               

              so i need the picklist inside the outputpanel because it's a result of ajax request.

               

              i tried to place my commandbutton into the outputpanel but in this case the button doesn't work at all.

               

              anyone have an idea plz

               

               

               

              • 4. Re: how to retrieve selected items in a picklist

                the problem was resolved