0

私は他のいくつかの投稿を見てきましたが、私がやろうとしているのは、設定されている Android でリクエストを介してオブジェクトを取得することです。

Google gcm アプリケーションを使用しています。

私のAndroidのコードは次のとおり

DefaultHttpClient hc=new DefaultHttpClient();
ResponseHandler <String> res=new BasicResponseHandler();
HttpPost postMethod=new HttpPost("http://192.168.1.111:8080/abc/d");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();  
nameValuePairs.add(new BasicNameValuePair("My_Value", "My_Value_entered"));  
postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs));  
String response=hc.execute(postMethod,res);

アプリケーション(サーブレット側)で値 My_value を取得したい。

編集: Android Post からオブジェクト値を取得するために Android コードに変更または修正が必要な場合は、お気軽に返信してください。

何か案が.....

4

1 に答える 1

1

jsoupどちらがはるかに使いやすいか試してみることができます。jsoup.orgで確認できます

編集:

このような:

Document document = Jsoup.connect("http://www......com/....php")
                .data("user","user","password","12345","email","info@tutorialswindow.com")
                .method(Method.POST)
                .execute()
                .parse();
于 2012-09-25T12:45:00.007 に答える