Send parameter using XMLHttpRequest

I am trying to use XMLHttpRequest to access a servlet. I would like to send it a value and based on the value return a specific value derived from a java class. So far all I can do is access the servlet.

Exactly what are you trying to return? Not to pick on you, but your posts have a history of asking "How do I do this?" without explaining exactly what this is.

You leave your servlet code dangling with assignments to MiscObjects instances, yet no one but you knows what MiscObjects is, or what you want to do with it. Or them, there are two. Which contains the useful data?

Such details are necessary for any substantive response to your questions.

I hope this gives the detail you need to help me. I will try and do better with my posts. Thanks for all your help.

I have a JSP in which the user fills out a form. On eof the fields is a customer job number. When the user types in this number I want another field on the form to be auto populated with a cooresponding CustomerID.

The job numbers and customerid's are located on an AS400 database.

Right now I have javascript in my JSP using the XMLHttpRequest object calling a servlet(url with a job number as a parameter) . The servlet creates an instance of a java connection class which returns the customerID from the result set. I can verify this by a System.out.println(). This is a string value.

My problem is how do I get this string back to the calling JSP?

I do not understand how to manipulate or control the response of the servlet. Do I some how give the response the value of the customerID string.

My last post contains my servlet code.

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1518

1

posted May 22, 2007 11:01:00

0

When I posted my lst message the last post by Bear was apperantly not complete yet beacuse I did not know I needs to address the MiscObjects. Yes my Servlet code is left dangleing because I do not know what to do next. I have assigned the result of the connection result to the MiscObjects jobCustomerString to make sure it is a string. The MiscObjects class has a getMiscString(). It is this value I need to send back to the calling JSP field. Please gnore the other MiscObjects code.