4 Replies Latest reply on Oct 29, 2009 10:50 PM by sai burgula

    pickList does not set property on the stateful bean

    Emil Iakoupov Newbie
      Hello,
      i have the following pickList:
      ...

             <s:decorate id="matchSkillsDecorate" template="display.xhtml">
                      <ui:define name="label">Skills:</ui:define>
                      <rich:pickList id="pickedSkills" 
                      value="#{userRegistration.pickedSkills}" style="width: auto;">
                      <s:selectItems id="skills" value="#{skills}" var="skill" label="#{skill.skillDescription}"/>
                      <s:convertEntity/>
                      </rich:pickList>
              </s:decorate>


      ... and the following submit
      <h:commandButton id="addAndContinueToResume" value="Add and Continue" action="#{userRegistration.addSelectedSkills}"/>

      ...
      now in the stateful bean i have the following:
      ..

              @DataModel("skills")
              private List<Skill> skills;
             
              private List<Skill> pickedSkills;

      ...
      for pickedSkills i have getters and setters defined. When i render the page, pickList works fine, i can move items from one to another etc. When i submit however, an empty ArrayList comes to
      public void setPickeSkills(List<Skill> pickedSkills);
      i can't figure this out, for a 2nd day now. Am i doing anyting wrong?

      Thank you.
        • 1. Re: pickList does not set property on the stateful bean
          Emil Iakoupov Newbie
          Hello I realized i have the same behavior with. h:selectManyListbox. Is it the converter? I also noticed that if i fill #{pickedSkills} with values before rendering the select many listbox in xhtml, those values will be pre-selected (moved in case of a pick list). i am using seam 2.1 cr1, jboss 4.2.3 GA. The bean has the following decalration:

          @Name("userRegistration")
          @Stateful
          public class UserRegistrationAction implements UserRegistration {

          @PersistenceContext(EXTENDED)
          EntityManager em;

          ... // other imports

          @DataModel("skills", scope=ScopeType.UNSPECIFIED)
          private List<Skill> skills;

          private List<Skill> pickedSkills;

          @Begin
          public void setUserType(String userType) {
          ...

          }

          ... other methods in the middle of conversation

          @End
          public void cancel() {
          ...
          }

          @End
          public void confirm() {
          ...}

          ... // setters and getters
          • 2. Re: pickList does not set property on the stateful bean
            Emil Iakoupov Newbie
            Hello,
            i realized i did not place pickList within <h:form> tag.
            • 3. Re: pickList does not set property on the stateful bean
              sai burgula Novice
              I have my rich:pickList within a <h:panelGrid> <h:form> such as

              <h:form>
              <h:panelGrid>
              <h:outputLabel value="Faculty Name" for="displayFacName" />
                                                                                              <rich:pickList value="#{courseSearch.selItemList}"
                             removeAllControlLabel="remove all"  
                             copyControlLabel="add"  
                             removeControlLabel="remove" 
                     converter="#{courseSearch.facConverter}" rendered="#courseSearch.resultListFilled}">
                         <f:selectItems value="#{courseSearch.pickListResult}"/>
              </rich:pickList>
              </h:panelGrid>

              <h:panelGrid columns="2">
                                                                                     
                 <s:link action="#{courseSearch.updateCourseOffr()}" value="Save Changes">
                      <f:setPropertyActionListener value="#{var}"
                      target="#{courseSearch.selectedCourse}" />
                      <s:conversationPropagation type="join" />
                 </s:link>

              <h:commandButton id="Reset" type="reset" value="Reset" />
              </h:panelGrid>

              If I change the s:link to h:commandButton the backing bean is not getting called.  If I keep it as s:link then my selItemList which is my picked item list, is empty.

              Please help and let me know what is wrong.....


              thanks
              Sai
              • 4. Re: pickList does not set property on the stateful bean
                sai burgula Novice
                In my  backing bean

                I defined the selectItem list as

                private List<SelectItem> selItemList= new ArrayList<SelectItem> ();

                and I have getters and setters for this.