Hi ,

I have a JUnit test in which I want to post data to a servlet which runs under 
tomcat 5.5.4. I created the post like this:

HttpClient client = new HttpClient();
PostMethod method = new PostMethod(URL);
method.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");        
        

NameValuePair[] data = {
 new NameValuePair(DataLoggerGate.PARAM_NAME_DATATYPE, 
Constants.PARAM_NAME_DATATYPE_EFFICIENCY_BLOCK_DATA),
 new NameValuePair(DataLoggerGate.PARAM_NAME_LOGGER, "DL-CO101-00000")
};

method.addParameters(data);
//method.setRequestBody(data);          
int statusCode = client.executeMethod(method);                  
String responseBody = method.getResponseBodyAsString();
System.out.println(responseBody);

But when I try to read the posted parameters in my servlet like this

 String dataType = (String)request.getParameter(PARAM_NAME_DATATYPE).trim();

I get always a NullPointerException. And when take a look at the request object 
in the debugger I see that no parameters are included in the request. What I'm 
doing wrong ?

Thanks, 
Lothar
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to