private void login() {
// 创建HttpPost对象,其主要作用是将Android手机端的数据提交给Web应用服务器
HttpPost httpRequest = new HttpPost(URL); // 将要传递的参数保存到List集合中
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("uname", userName.getText().toString()));
params.add(new BasicNameValuePair("upswd", password.getText().toString())); try {
// 设置字符集
HttpEntity entity = new UrlEncodedFormEntity(params, "utf-8");
httpRequest.setEntity(entity);
// 执行连接
HttpResponse response = httpClient.execute(httpRequest);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
//获取返回的数据
result += EntityUtils.toString(response.getEntity(), "utf-8");
Log.e("服务返回数据:", result);

} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} }对result做了下Log,没有反应,是不是我BasicNameValuePair的key或者是一开始的URL错了。就算我登录的时候账号密码有误,Log怎么也该显示下服务器返回的数据result啊。求指教!服务器urlresult BasicNameValuePair返回数据