List<NameValuePair> params = new ArrayList<NameValuePair>(); 定义了一个list,该list的数据类型是NameValuePair(简单名称值对节点类型),这个代码多处用于Java像url发送Post请求。在发送post请求时用该list来存放参数。 发送请求的大致过程如下: String url="http://www.baidu.com"; HttpPost httppost=new HttpPost(url); //建立HttpPost对象 List<NameValuePair> params=new ArrayList<NameValuePair>(); //建立一个NameValuePair数组,用于存储欲传送的参数 params.add(new BasicNameValuePair("pwd","2544")); //添加参数 httppost.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8)); //设置编码 HttpResponse response=new DefaultHttpClient().execute(httppost); //发送Post,并返回一个HttpResponse对象