我用这个 HttpClient 库玩了一段时间(几周)。我想以某种方式将 Attribute 设置为请求。不是参数而是属性。在我的 servlet 中,我想使用 Integer inte = (Integer)request.getAttribute("obj");
我不知道我想念什么。我试试这个。
NameValuePair[] pair = new NameValuePair[1];
pair[0] = new NameValuePair();
pair[0].setName("aloha");
pair[0].setValue("value");
但是这个设置参数不是属性。我也使用它,因为这只是一个对象,它具有接受字符串和对象的方法。仍然没有解决。
HttpClientParams clParam = new HttpClientParams();
clParam.setParameter("obj", new Integer(24405));
method.setParams(clParam);
请给我一些线索....谢谢。