At a glance, I can't spot anything going wrong in the Servlet or JSP. However, if I had to venture a guess, you might want to double-check this:
Code:
function callServlet(formElement) {
var searchQuery = document.forms[0].elements[formElement].value;
http.open("GET", theURL + escape(searchQuery), true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}
You're doing stuff there that I'm not familiar with. Is it Javascript or ActiveX? Further, I'm not sure you're forming the HTTP request correctly in that bit of code, so the might explain the problems.