hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohit Anchlia <mohitanch...@gmail.com>
Subject How to set parameters
Date Wed, 20 Jul 2011 23:04:39 GMT
I have this servelet code that gets parameter on post. Something like

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) {

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

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

View raw message