2 Replies Latest reply on Aug 11, 2007 3:58 AM by kaviarasu

    Fetch data from database and display in autocomplete

    kaviarasu

      hi
      i want to use a auto complete in my page.
      insted of declaring the values in bean as per in the demo
      http://livedemo.exadel.com/richfaces-demo/richfaces/suggestionBox.jsf?c=suggestionBox

      i want to fetch the values from database and display in the autocomplete

      how this is possible.

      thank you
      regards
      Kaviarasu

        • 1. Re: Fetch data from database and display in autocomplete

          All you need is to implements suggestionAction that goes to the database.

          • 2. Re: Fetch data from database and display in autocomplete
            kaviarasu

            hi
            shall i create a bean like below
            i can able to get the list database how to use this output in the suggestionAction

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



            and in pages.xml file

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



            now can u say how to use the List country in suggestionAction
            thank u
            regards
            kaviarasu