Announcement Announcement Module
Collapse
No announcement yet.
Search auto complete. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Search auto complete.

    Im doing a web app using Spring MVC, Hibernate and JSP as my view layer.

    I want an autocomplete search like Youtube's video search, or Facebook's network search.

    What technology do I need to use to do this?

    The only way I can think to do it is by putting everything in my referenceData map and then using javascript to match what the user types. This doesnt seem like a particularly efficient way to do this if there are a lot of possible search terms (which there is).

    Any ideas any one?

    Thanks in advance.

  • #2
    Dojo's FilteringSelect has exactly the behavior you describe with fetching all data on the client side and letting you type free form to find a match.

    If the data set is larger you'll need to make an Ajax call. You can use a library like Dojo, jQuery, YUI, GWT, etc. to make the call and then return JSON data from the server side but it's best to use a pre-built component to handle more advanced parts like how many letters should start the search, how long to wait, etc.

    Dojo doesn't have a component specifically for that but you can connect a FilteringSelect widget to a data store, which manages the data for the select.

    Comment


    • #3
      I created such a search functionality with a AJAX query, with DWR to be more specific. DWR integrates really easy with Spring 2.x projects (and with spring 1 as well). I think there is some online tutorial about such functionality implemented with DWR.

      Comment


      • #4
        Thanks for the answers guys, I'm going to give the FilteringSelect and DWR a go to see which works the best.
        Thanks again.

        Comment


        • #5
          Hello there,

          I'm using jquery.autocomplete plugin and it works just great!

          Comment


          • #6
            Thanks for the response all, I ended up opting for DWR. Works really well. Integrated quite nicely with Spring and really wasn't difficult to do once I read the docs.

            Thanks again.

            Comment


            • #7
              krzychu ,

              Could you please share how did you do. I did get result from mvc controller but its its showing entire jsp page rather than just list results.

              <script>


              $(document).ready(function(){
              var url = "searchResult.htm";
              $("#example").autocomplete(url);
              });
              </script>

              </head>
              <body>
              API Reference: <input id="example" /> (try "C" or "E")
              </body>

              Comment


              • #8
                Re

                Hi All,
                There is a tag in <form:input autocomplete=""/>.
                Can any one help me showing me the example for the same.

                thanks in advance.


                Ragards and Thanks,
                Balkeshwar

                Comment

                Working...
                X