0 Replies Latest reply on Aug 11, 2007 9:41 AM by kaviarasu

    Fetching data from database to Autocomplete

    kaviarasu

      Hi
      i want to use autocomplete for my page

      i execute the query using the line

      <page view-id="/home.xhtml" action="#{mes.findMessages}" />


      and the bean class is


      @Stateful
      
      @Scope(SESSION)
      @Name("mes")
      public class Dispaly implements Serializable, ExpertReview {
      
       @DataModel
       @Out
       private List<String> country1;
      
       @PersistenceContext
       private EntityManager em;
      
      
       public String findMessages() {
       country1 = em.createQuery("select ter from TblProductTag ter")
       .getResultList();
       System.out.print(country1);
      
       return "aaa";
       }
      
       @Remove @Destroy
      public void destroy() {}
      }



      and i want to pass to



      <rich:suggestionbox id="suggestionBoxId" for="country" tokens=",["
       rules="#{suggestionBox.rules}"
       suggestionAction="#{suggestionBox.autocomplete}" var="result"
       fetchValue="#{result.text}" rows="#{suggestionBox.intRows}"
       first="#{suggestionBox.intFirst}"
       minChars="#{suggestionBox.minchars}"
       shadowOpacity="#{suggestionBox.shadowOpacity}"
       border="#{suggestionBox.border}"
       width="#{suggestionBox.width}"
       height="#{suggestionBox.height}"
       shadowDepth="#{suggestionBox.shadowDepth}"
       cellpadding="#{suggestionBox.cellpadding}">



      when i execute the page im getting the output of the query as


      [model.TblProductTag@1746634, model.TblProductTag@e1fa50, model.TblProductTag@1f8aa07, model.TblProductTag@62b4a1, model.TblProductTag@40ba54]



      and the error message as


      attempted to bind an @Out attribute of the wrong type to: mes.country1


      how to send the list
      suggestionAction

      Thank you
      regards
      Kavi