hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohit Anchlia <mohitanch...@gmail.com>
Subject Re: How to set parameters
Date Thu, 21 Jul 2011 17:13:40 GMT
Never mind figured it out. There was case issue, only visible to me
using tcpdump :)

On Wed, Jul 20, 2011 at 4:04 PM, Mohit Anchlia <mohitanchlia@gmail.com> wrote:
> I have this servelet code that gets parameter on post. Something like
> request.getParameter("requestType");
>
> On the client I do this:
>
>       List<NameValuePair> pairs = new ArrayList<NameValuePair>();
>
>       for (String s : attrib.keySet()){
>           System.out.println(s + attrib.get(s));
>           pairs.add(new BasicNameValuePair(s, attrib.get(s)));
>       }
>
>       try {
>                httppost.setEntity(new UrlEncodedFormEntity(pairs,HTTP.UTF_8));
>                HttpResponse response = httpclient.execute(httppost);
>        HttpEntity entity = response.getEntity();
>        if (entity != null) {
>            System.out.println(EntityUtils.toString(entity));
>        }
>
>
> attrib is name value and I name sure that it's the first parameter is
> requestType and second it's value. But servlet still is not able to
> get the parameter from the client. Not sure what's incorrect in above
> code.
>
> I created simple HTML form and that seem to work well.
>

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


Mime
View raw message