我希望在HTTP Post请求中添加List<Beans>
。
在使用Apache HTTPClient
时,我无法做同样的事情。
这就是我想要做的事情:
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("dailySalesList",beanList));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
但是,BasicNameValuePair似乎只接受2个字符串作为参数。我希望利用它,以便我可以使用字符串 - 用于标识和对象 - 来传递List。 基本上类似于使用Map的功能。
关于如何使用Apache HTTPClient
完成任何指示?