0 Replies Latest reply on Sep 18, 2008 5:59 AM by assyst

    Combobox Data population issue

    assyst
      I have a User Registration Form for entering user details. In this form there is one field for setting User Group,
      I am able to populate the values into the combo box(from the database) but when i submit the form ,an exception occurs and i didn't get the combobox selected user group value .

      Exception:
      INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, bu
      may not have been displayed.
      sourceId = j_id10:j_id46[severity=(ERROR 2), summary=(value is required), detail
      value is required)]


      Please help me to solve this problem....

      Combo box xhtml code:

      <h:outputLabel>Group:</h:outputLabel></td>
             
      <h:selectOneMenu name="group" id="userGroupId" value="#{userBean.userGroupId}" tabindex="4" >

      <s:selectItems value="#{groups}" var="group"  label="#{group.groupReferenceId}" itemValue="#{group}" noSelectionLabel="-- Select Group --" />
                                                                              <s:convertEntity/>
      </h:selectOneMenu>
                                                                                                     
      Action Class:-

      @Stateful
      @Name("userAction")
      @Scope(SESSION)
      public class UserAction implements User, Serializable{
             
              private GroupBean groupBean = null;
             
              @PersistenceContext 
              private EntityManager em = null;
             
              @Logger
              private static Log log = null;
             
              @DataModel  
              private List<GroupBean> groups = null;
             
             
              @In
              private transient FacesContext facesContext;

             
             
              public String addUser() {
                     
                      userBo = new UserBO();
                      groups = em.createQuery("select group from
                               GroupBean group").getResultList();
                      return "addUser";
                     
              }
             

                     
              @Destroy @Remove
              public void destroy() {
                      
                      
              }

      }                                                                                              
                                                                              Entity Bean:--

      @Entity
      @Name("groupBean")
      @Scope(SESSION)
      public class GroupBean implements Serializable{
             
              private static final long serialVersionUID = 1L;
              private String groupId = null;
          private String groupReferenceId = null;

              public GroupBean() {
                     
              }
              public GroupBean(String groupId, String groupReferenceId){
                      this.groupId = groupId;
                      this.groupReferenceId = groupReferenceId;
              }
             
              @Id @GeneratedValue
              public String getGroupId() {
                      return groupId;
              }
              
              public void setGroupId(String groupId) {
                      this.groupId = groupId;
              }
             
              public String getGroupReferenceId() {
                      return groupReferenceId;
              }
             
              public void setGroupReferenceId(String groupReferenceId) {
                      this.groupReferenceId = groupReferenceId;
              }

      }