There are numerous utilities to add auto-complete functionality to your site/application.I found them complex to use leading me to write one for myself.
It has three simple steps
1.Make asynchronous call to the server(handled by servlet) using XMLHttpRequest .
2.Get the required data in servlet and send the response as XML
3.Grab and process the data(display) in the front end when control is returned from the server.
The above three steps are common for any functionality achieved using AJAX.
The jsp page looks like this

In the above jsp if you have seen, on "onkeyupevent", function getData is called passing in the 4 parameters.The javascript file(its in text format) can be downloaded here
The servlet which handles the synchronous call made by jsp is shown below.The data to to be loaded is initialized by overriding the init method of the servlet(data retrieval will vary according to ones need)
That is pretty much.There is definitely a huge room for improvement but its gets the target rolling.
NOTE:The blogger.com parses everything ,so I had to include code in images.If anybody knows a better way to include code in blogspot, will be great.Thanks