You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Lee Wai See <le...@stee.stengg.com> on 2006/09/28 11:47:46 UTC
Using HttpClient for sender and HttpServlet for receiver for parameters
Hi,
I have the following situation which I hope someone would be able to help me
with.
On the sender side, I am using HttpClient and have these few lines:
HttpClient httpClient = new HttpClient();
postMethod.addParameters (data); // data is of type
NameValuePair[]
httpClient.executeMethod(postMethod);
On the receiver side, I need to use the javax.servlet.http.HttpServlet with
the HttpServletRequest req. How can I get the parameters of NameValuePair[].
If I do a req.getParameter(), I will only get the first element of the
NameValuePair[].
I want to get all the elements of NameValuePair[]. How can I go about doing
it? It would be greatly appreciated if someone could guide me in this.
Thanks in advance.
Regards,
Lee Wai See
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.9/457 - Release Date: 9/26/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.9/457 - Release Date: 9/26/2006
[This e-mail is confidential and may be priviledged. If you are not the
intended recipient, please kindly notify us immediately and delete the message
from your system; please do not copy or use it for any purpose, nor disclose
its contents to any other person. Thank you.]
---ST Electronics Group---
Re: Using HttpClient for sender and HttpServlet for receiver for
parameters
Posted by Ortwin Glück <od...@odi.ch>.
-- client
NameValuePair[] data = new NameValuePair[] {
new NameValuePair("surname", "Lee"),
new NameValuePair("name", "Wai See")
};
-- servlet
String surname = request.getParameter("surname");
String name = request.getParameter("name");
Hope that helps
Ortwin
Lee Wai See wrote:
> Hi,
>
>
>
> I have the following situation which I hope someone would be able to help me
> with.
>
>
>
> On the sender side, I am using HttpClient and have these few lines:
>
> HttpClient httpClient = new HttpClient();
>
> postMethod.addParameters (data); // data is of type
> NameValuePair[]
>
> httpClient.executeMethod(postMethod);
>
>
>
> On the receiver side, I need to use the javax.servlet.http.HttpServlet with
> the HttpServletRequest req. How can I get the parameters of NameValuePair[].
> If I do a req.getParameter(), I will only get the first element of the
> NameValuePair[].
>
>
>
> I want to get all the elements of NameValuePair[]. How can I go about doing
> it? It would be greatly appreciated if someone could guide me in this.
> Thanks in advance.
>
>
>
> Regards,
> Lee Wai See
>
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.12.9/457 - Release Date: 9/26/2006
>
>
>
--
[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