list需要通过专为json对象来提交阿吉;答复HttpPost post = new HttpPost("http://192.168.1.103:8080/submit"); post.addHeader("Content-type", "application/json;charset=utf-8"); post.setHeader("Accept","application/json"); Httpclient httpClient = new DefaultHttpClient(); String billListStr = (new Gson()).toJson(billList); //billList为所要提交数据 post.setEntity(new StringEntity(billListStr, "utf-8")); HttpResponse response = httpClient.execute(post); if (response.getStatusLine().getStatusCode() == 200) { String json = EntityUtils.toString(response.getEntity()); //TODO处理返回的json数据 }
HttpClient如何提交list
最新推荐文章于 2023-12-07 10:10:13 发布