Hi,
I need to have a method which opens a connection to a servlet, posts some
data, and reads the output. I wrote the following code in that method.
// Method
String strUrl = "http://localhost:8080/servlet/MyServlet";
String strQuery = "i1=" + URLEncoder.encode("420");
URL url = new URL(strUrl + "?" + strQuery);
URLConnection connection = url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setAllowUserInteraction(false);
/* Commented out
DataOutputStream output = new
DataOutputStream(connection.getOutputStream());
output.writeBytes(strQuery);
output.close();
*/
// Read in the response
BufferedReader input = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
//Continue processing.....
// End of method
In MyServlet servlet when I say request.getParameter(i1) I seem to get a
null value.
However when I uncomment the commented lines of code, it works!
Does anyone know the reason?. I use VAJ 3.02 with Websphere test
environment.
Thanks
Shaji B
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html