users@glassfish.java.net

Re: RE: UISelectMany and POJOs: "Value Is Not Valid"

From: <glassfish_at_javadesktop.org>
Date: Fri, 13 Jul 2007 01:09:37 PDT

Hi,

Also face this problem. But when put String into SelectItem seems to be working. Only when put in object the validation error occurs.

My bean code is as below:
    public UIComponentBase getUserGroupsList(){
        EntityManager em = getEntityManager();
         listUserGroup = (List <UserGroup>) em.createQuery("select o from UserGroup as o").getResultList();
         
         
         list=new UISelectMany();
         System.out.println("sizeof list:"+listUserGroup.size());
         
         SelectItem item = new SelectItem();
            for(UserGroup x : listUserGroup) {
                    item = new SelectItem(x);
                                 
         UISelectItem uiItem = new UISelectItem();
         uiItem.setValue( item );
         
         list.getChildren().add( uiItem );
         }
      return list;
    }

The web page code :

                    <h:outputText value="User Group Assigned:"/>
                    <h:selectManyListbox binding="#{user.userGroupsList}">
[Message sent by forum member 'krashsun' (krashsun)]

http://forums.java.net/jive/thread.jspa?messageID=226522