android post请求的问题
android的代码Stringurl=HttpUtil.URL+"login";List<NameValuePair>params=newArrayList<NameV...
android的代码
String url = HttpUtil.URL + "login";
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("account", name));
params.add(new BasicNameValuePair("password", password));
try {
String str = HttpUtil.requestStringForPost(url, params);
System.out.println(str);
servlet的代码
//获得账号密码
String username = request.getParameter("account");
String password = request.getParameter("password");
System.out.println("user---->"+username+"password---->"+password);
打印的结果是
user--->name password---> name
为什么两个值都是name 展开
String url = HttpUtil.URL + "login";
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("account", name));
params.add(new BasicNameValuePair("password", password));
try {
String str = HttpUtil.requestStringForPost(url, params);
System.out.println(str);
servlet的代码
//获得账号密码
String username = request.getParameter("account");
String password = request.getParameter("password");
System.out.println("user---->"+username+"password---->"+password);
打印的结果是
user--->name password---> name
为什么两个值都是name 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询