hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ortwin Glück <...@odi.ch>
Subject Re: <<<PostMethod - Help Required
Date Mon, 24 Oct 2005 08:17:45 GMT
Dummy (cute),

You may want to use an actual *instance* of the servlet request in your 
servlet code:

protected void doGet(HttpServletRequest req, HttpServletResponse resp) {

   String parameterValue = req.getParameter("paramname");

}

Cheers

Ortwin Glück

dummy dum wrote:
> 
> dummy dum <dummydev@yahoo.com> wrote: 
> Hi,
>   I had  posted a html parameter to the a java servlet using org.apache.commons.httpclient.methods.PostMethod
> but iam retrive the posted data(param-name) using 
> javax.servlet.http.HttpServletRequest.getParameter("paramname")
> i get a "null" value. I searched forums but Iam not able get the solution.
>  
> httpclient version used: commons-httpclient-3.0-rc2 
>  
> 
> <The code I used is>
> 
>  
> 
>   HttpClient httpClient =   new HttpClient();
>   PostMethod postMethod = new PostMethod("url");
> 
>  
> 
> NameValuePair[] data= new NameValuePair[1];
> data[0] = new NameValuePair("paramname", "paramvalue");
> postMethod.setRequestBody(data);
> 
>  
> 
>   int httpStatus = httpClient.executeMethod(postMethod);
> 
>  
> 
>   InputStream in = postMethod.getResponseBodyAsStream();
> 
>       ...........
> 
>  
> 
> <The java servlet code is >
> 
>  
> String parameterValue = javax.servlet.http.HttpServletRequest.getParameter("paramname");
>  
> 
> could u help in this ASAP.
> 
>  
> 
> thanks in advance,
> 
>  
> 
> the dummy
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 
> 		
> ---------------------------------
>  Yahoo! FareChase - Search multiple travel sites in one click.  

-- 
[web]  http://www.odi.ch/
[blog] http://www.odi.ch/weblog/
[pgp]  key 0x81CF3416
        finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message