1

を使用して Java オブジェクトを HTTP POST パラメータに渡したいjava.net.*ですか? オブジェクトには複数のパラメーターが含まれています。

4

1 に答える 1

2

試す

HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(REQUEST_URL);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
//put here in nameValuePairs request parameters

UrlEncodedFormEntity form;
form = new UrlEncodedFormEntity(nameValuePairs, "UTF-8");
form.setContentEncoding(HTTP.UTF_8);
httppost.setEntity(form);

HttpResponse response = httpclient.execute(httppost);
于 2013-02-01T11:46:48.683 に答える