5 Replies Latest reply on Sep 17, 2009 4:50 PM by twoencore

    s:convertEntity

    mickgiu.mickgiu.gmail.com

      Hi,
      i'm new of seam and jboss developer. I want to create a search form and display results with datatable.
      I don' want to use EntityQuery like wizard of developer.
      In my form i have a
      h:selectOneMenu
      s:selectItems
      s:convertEntity.
      It doesn't work.
      it depends because form is not associated with entity?


      And can someone gime me an example of usage.
      thanks in advance
      mickgiu

        • 1. Re: s:convertEntity
          admin.admin.email.tld
          <h:selectManyListbox size="10" value="#{member.roles}"> 
               <s:selectItems var="r" value="#{availableRoles}" label="#{r.name}"/> 
               <s:convertEntity/> 
          </h:selectManyListbox>



          <h:selectOneMenu value="#{person.continent}" required="true">
                <s:selectItems value="#{continents.resultList}" var="continent"
                               label="#{continent.name}"
                               noSelectionLabel="Please Select..."/>
                <s:convertEntity />
          </h:selectOneMenu>

          • 2. Re: s:convertEntity
            mickgiu.mickgiu.gmail.com

            Hi, thanks for the answer but i had done as you wrote me.
            I have a page that contains this code


                  <h:selectOneMenu value="#{hotelSearch.pippolo}"> 
            
                   <s:selectItems value="#{hotelSearch.capitalsList}" var="continent" 
                             label="#{continent.countryName}"   
                             noSelectionLabel="Please Select..."/>
                <s:convertEntity />   
                </h:selectOneMenu>


            and an ejb like this


            public class UtiSearchAction implements UtiSearch
            {
               
               @PersistenceContext
               private EntityManager em;
               
               
               private Countries pippolo;
               private List<Countries> capitalsList;
               
               @Create
               public void init() {
                    capitalsList = em.createQuery("select c from Countries c ").getResultList();
                    pippolo = new Countries();
                    pippolo = capitalsList.get(1);
               }
               
               @DataModel
               private List<Locations> hotels;
               
               
               public List<Countries> getCapitalsList() {
                 return capitalsList;
            }
            public void setCapitalsList(List<Countries> capitalsList) {
                 this.capitalsList = capitalsList;
            }
            public Countries getPippolo() {
                 return pippolo;
            }
            public void setPippolo(Countries pippolo) {
                 System.out.println("ciao");
                 this.pippolo = pippolo;
            }


            when i load data for dropdown all is ok: when dropdown put value (i think) i get this error



            value is not valid

            i don't understand where is the error.
            thank
            mickgiu

            • 3. Re: s:convertEntity
              admin.admin.email.tld

              that indicates that the data value for the drop-down is invalid.  find out what the data value is.  also, are you using any validators or Hibernate validators?

              • 4. Re: s:convertEntity
                mickgiu.mickgiu.gmail.com

                Hi,
                i found that problem is in


                public boolean equals(Object object)



                of Entity object ( as i read in other forum).
                Data value is ok, if i override that method (and return true) all is ok.
                Bu this is not a solution.
                Can you help me ?
                Thanks

                • 5. Re: s:convertEntity

                  I think your missing the id attribute.




                        <h:selectOneMenu value="#{hotelSearch.pippolo}"> 
                  
                         <s:selectItems value="#{hotelSearch.capitalsList}" 
                                         var="continent" 
                                         label="#{continent.countryName}"
                                         id="pk"
                                         noSelectionLabel="Please Select..."/>
                           <s:convertEntity />   
                      </h:selectOneMenu>