在插入后的jsp中,我使用以下代码向android发送成功或失败
response.setContentType("text/html");
ObjectOutputStream oos = new ObjectOutputStream(response.getOutputStream());
oos.writeObject("success");
out.print("success");
在android中,我使用以下代码接收数据
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.mysite.com.au/validation1.jsp");
List<NameValuePair> namevaluepairs = new ArrayList<NameValuePair>(2);
namevaluepairs.add(new BasicNameValuePair("pin",pass));
httppost.setEntity(new UrlEncodedFormEntity(namevaluepairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity rp = response.getEntity();
String origresponseText = EntityUtils.toString(rp);
String responseText = origresponseText.substring(7, origresponseText.length());
Toast.makeText(getApplicationContext(), "Incoming data-->"+responseText, Toast.LENGTH_SHORT).show();
if(responseText.equals("success")){
// do something
}
使用此代码从 JSP 接收数据到 Android 是否有任何缺点
我的应用程序在我的手机上完美运行,即索尼 xperia....但是同一个应用程序在其他一些手机中没有响应不是全部....谁能告诉我这背后的原因是什么