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:[EMAIL PROTECTED] > Sent: Monday, July 07, 2003 4:55 PM > To: [EMAIL PROTECTED] > 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: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]