1 2 Previous Next 15 Replies Latest reply on May 6, 2007 3:53 AM by pmuir

    Problem with s:convertEntity

    seto

      When I choose one of the category, nothing happen. But when i choose the no selection label, the form is submitted normally. Anyone could help me? Please, I'm waiting anxiously online now.

      
       <h:form>
       <s:validateAll>
       <h:messages globalOnly="true" />
       <h:panelGrid columns="2">
       <h:outputText value="tag />
       <h:inputText value="#{brand.tag}" required="true" />
       <h:outputText value="name" />
       <h:inputText value="#{brand.name}" required="true" />
       <h:outputText value="category" />
       <h:selectOneMenu value="#{brand.category}">
       <s:selectItems value="#{categoryList}" var="category"
       label="#{category.name}" noSelectionLabel="please choose" />
       <s:convertEntity />
       </h:selectOneMenu>
       </h:panelGrid>
       <h:commandButton value="new" action="#{brandHome.persist}"
       rendered="#{!brandHome.managed}" />
       <h:commandButton value="edit" action="#{brandHome.update}"
       rendered="#{brandHome.managed}" />
       <h:commandButton value="delete" action="#{brandHome.remove}"
       rendered="#{brandHome.managed}" />
       </s:validateAll>
       </h:form>
      

       @SuppressWarnings("unchecked")
       @Factory
       public void getCategoryList() {
       entityManager.clear();
       categoryList = entityManager.createQuery("from Category category")
       .getResultList();
       Contexts.getSessionContext().flush();
       }
      

       <factory name="brand" value="#{brandHome.instance}" />
       <fwk:entity-home name="brandHome"
       entity-class="com.hongyang.domain.directory.Brand" />
      

       @ManyToOne
       @JoinColumn(name = "category")
       private Category category = new Category();
      


        1 2 Previous Next