hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Rana" <r...@solis.jp>
Subject RE: How to post to a URL with Checkbox ?
Date Mon, 07 Jul 2003 08:17:27 GMT
HttpClient client = new HttpClient();
HttpMethod method = new PostMethod(URL); 
NameValuePair pair = new NameValuePair[2];
pair[0] = new NameValuePair("cb", "on"); 
pair[1] = new NameValuePair("n", "Eric");
((PostMethod) method).setRequestBody(parameters);
client.executeMethod(method);
byte[] responseBody = method.getResponseBody();

HTH,

NOTE: You will have to add appropriate error/exception handling.

Regards,
Amit.

> -----Original Message-----
> From: Eric Chow [mailto:echow@macaucabletv.com]
> Sent: Monday, July 07, 2003 4:55 PM
> To: commons-httpclient-dev@jakarta.apache.org
> Subject: How to post to a URL with Checkbox ?
> 
> Hello,
> 
> If the HTML form is like the following :
> 
> <form method="post" action="/servlet/Show">
>     <input type=checkbox name="cb">
>     <input type=text name="n">
>     <input type="submit" value="Show">
> </form>
> 
> 
> How can Post to "/servlet/Show" with the values as following ?
> 
> n=Eric   and the CheckBox should be "CHECKED"
> 
> Please help ???
> 
> 
> 
> Best regards,
> Eric
> 
> 
> 
> 
> 
> ==========================
> If you know what you are doing,
> it is not called RESEARCH!
> ==========================
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-httpclient-dev-help@jakarta.apache.org


Mime
View raw message