List<NameValuePair> params = new ArrayList<NameValuePair>()的具体含义
来源:互联网 发布:php中截取字符串 编辑:程序博客网 时间:2024/06/05 19:30
定义了一个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对象
发送请求的大致过程如下:
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对象
0 0
- List<NameValuePair> params = new ArrayList<NameValuePair>()的具体含义
- List<NameValuePair> params = new ArrayList<NameValuePair>();
- NameValuePair
- NameValuePair
- namevaluepair
- namevaluepair
- NameValuePair
- NameValuePair 的作用
- NameValuePair的用法
- NameValuePair问题
- Android Post参数提交 List<NameValuePair>,web端获取数据
- The constructor UrlEncodedFormEntity(List<NameValuePair>, String) is undefined
- AndroidのNameValuePair类
- HttpClient---NameValuePair参数问题
- android namevaluepair 过时
- HttpClient---NameValuePair参数问题
- 我的Android进阶之旅------>android如何将List<NameValuePair>请求参数列表转换为json格式
- List list = new ArrayList();和ArrayList list=new ArrayList();的区别
- struts2 中 Actionsupport 的作用
- 多线程中的生产者和消费者模式
- 前美国财星500大企业资安长澄清Container技术的6大资安迷思
- java学习过程中的各种BUG
- C++第三方日志库Pantheios
- List<NameValuePair> params = new ArrayList<NameValuePair>()的具体含义
- undefined reference to `__android_log_print'
- 朴素贝叶斯与逻辑回归的区别
- poj 2486 树形dp
- Android媒体库使用分组查询
- 对抗网络用于人脸转正--Beyond Face Rotation
- 数据库基础知识六
- 参加CCF CSP认证者须知
- 把数组排成最小的数