hi..im using ajax to send some data according to the name selected from the combo box to the servlet..i hav managed to get the necessary values from the database to the servlet as a LIST but im clueless on how to send those values to jsp and print in the page...if i can hav a smaple code it would be very helpful..thank u in advance...

Hussain

Ajax Code..

var selectedAuthor = author.options[author.selectedIndex].value
alert(selectedAuthor);
var url = "/HRS2/AjaxServlet?author=" + escape(author.value);

if (window.XMLHttpRequest) {
req = new XMLHttpRequest( );
}
else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.open("Get",url,true);
req.onreadystatechange = callbackAuthor;
req.send(null);

}

function callbackAuthor() {

if (req.readyState==4) {

if (req.status == 200) {

authorCheck( );

}
else
{

}
}
}

function authorCheck( ) {
//i think the printing comes here...
}

I would suggest using a bean, and then using the getter method on the jsp to get the information from the servlet.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.