Justin
Justin

Reputation: 11

Retrieve values at the time of edit in jsp?

I am new to jsp. I have the list of names in the database. I need to get the list of names at the time of enter the values in the textbox as like a google search(using Ajax). I need the simple sample for this.Can anyone help me !!!!!

Upvotes: 0

Views: 76

Answers (2)

Harry Joy
Harry Joy

Reputation: 59670

Do as Follows:

In Javascript using Ajax:

    xmlhttp=new XMLHttpRequest();

    url=url+"?val="+str1;

    xmlhttp.open("POST",url,false);

    xmlhttp.send(null);

    document.getElementById('my2').innerHTML=xmlhttp.responseText;

Where url will be the URL to which you will post data. Str1 is the typed value in textbox. and my2 is the box which you will show as auto suggest.

At serverside coding in Servlet get the names from db and send it in response to display.

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1039140

Here's a tutorial you might find useful.

Upvotes: 2

Related Questions