Package com.test.action;
Import java.io.IOException;
Import java.util.ArrayList;
Import java.util.List;
Import Org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
Import Org.apache.commons.httpclient.Header;
Import org.apache.commons.httpclient.HttpClient;
Import org.apache.commons.httpclient.HttpException;
Import Org.apache.commons.httpclient.HttpStatus;
Import Org.apache.commons.httpclient.methods.PostMethod;
Import Org.apache.commons.httpclient.params.HttpMethodParams; /** * * Dependent commons-httpclient-3.1.jar Commons-codec-1.4.jar * @author Tianjun * */public class Posttest {public stat
IC void Main (string[] args) {//(1) Example of constructing HttpClient HttpClient HttpClient = new HttpClient ();
(2) Create an instance of the Post method Postmethod Postmethod = new Postmethod ("http://localhost:8080/b/test1.do");
GetMethod GetMethod = new//GetMethod ("http://localhost:8080/b/test1.do");
(3) Set HTTP request header list