2 Replies Latest reply on Mar 1, 2007 1:04 PM by pgmjsd

    <s:selectItems noSelectionLabel=

    pgmjsd

      I'm using Seam 1.1.6, myfaces 1.1.4, EntityConverter 0.1 from the wiki page. The Seam managed EntityManagerFactory is set up correctly.

      Here's the problem: When noSelectionLabel is specified UISelectItems ends up using NoSelectionConverter for all the User objects in the list instead of using EntityConverter. When the form is posted, the values for the select are the 'toString()' of the User entity, which EntityConverter doesn't understand.

      Anyone else have this problem? Is it fixed in 1.2? Should I even bother with noSelectionLabel and EntityConverter?

      Here's the view code:

       <h:selectOneMenu id="theSelect" value="#{myBean.selectedUser}">
       <s:selectItems value="#{myBean.users}" var="user"
       noSelectionLabel="Select a user..." label="#{user.name}"/>
       <ec:convertEntity/>
       </h:selectOneMenu>
      


      Here's the SSB:

      @Name("myBean")
      @Stateful
      @Logging
      public class TestBean implements TestLocal
      {
       @PersistenceContext
       private EntityManager em;
      
       private List<User> users;
      
       private User selectedUser;
      
       public List<User> getUsers()
       {
       if (users == null)
       {
       Query q = em.createQuery("select t from User t join t.roles r where r = :role");
       q.setParameter("role", Role.SPECIAL_ROLE);
       //noinspection unchecked
       users = q.getResultList();
       }
       return users;
       }
      
       public User getSelectedUser()
       {
       return selectedUser;
       }
      
       public void setSelectedUser(User selectedUser)
       {
       this.selectedUser = selectedUser;
       }
       @Destroy
       @Remove
       public void destroy()
       {
       }
      }