2 Replies Latest reply on Oct 26, 2009 8:04 AM by petitefl3ur

    pickList

    petitefl3ur Newbie

      Hi everyone,

      I have a strange behavior with a picklist...i'm quite resign because i don't understand why this piece of code doesn't work. I certainly miss something...

      So let me explain, i work with Seam 2.2.0.GA and all libs that are package with this version.Server is jboss 5.1

      I am initializing the pickList in a EBJ when i load the page

      pages.xml

      <page view-id="/skill.xhtml" no-conversation-view-id="/home.xhtml">
       <action execute="#{skillAction.init()}" />
       <navigation>
       <rule if-outcome="updated">
       <redirect view-id="/user.xhtml" />
       </rule>
       </navigation>
      </page>
      


      SkillAction.java
      public String init() {
       skills = skillDAO.findAuthorizedSkills(User.getId());
       skillsSelected = skillDAO.findSelectedSkin(User.getId());
       return "initialized";
      }
      
      public String save() {
       user.setSkills(skillsSelected);
       user = entityManager.merge(user);
       entityManager.flush();
       return "updated";
      }
      


      skill.xhtml
      <rich:pickList id="skillPickList" value="#{skillAction.skillsSelected}">
       <s:selectItems value="#{skillAction.skills}" var="_skill" label="#{_skill.name}"/>
       <s:convertEntity/>
      </rich:pickList>
      ...
      <h:commandLink id="skillSave" action="#{skillAction.save()}" >
       <h:outputText value="Save"/>
      </h:commandLink>
      


      The thing is that it works perfectly the on the first launch...i can select or unselect items, the whole modification are put into the database.
      But if i logout, or restart the server, my skills that are in the database are not display anymore in the pickList component. And when i log the size of the lists in the init method of the EJB skillAction, lists are with correct size everytime, but anything happened with the pickList component!

      I have this in my component.xml in order to manager a converter
      components.xml
      <component name="org.jboss.seam.ui.entityConverter">
       <property name="entityManager">#{entityManager}</property>
      </component>
      


      and in Skill.java entity bean i have override equals method to get the comparaison on the id.


      Where i am wrong? Why the richfaces component doesn't want my lists!? Do i have to write a specific converter?

      Thx in advance.