HttpClient client = new HttpClient();
PostMethod post = new PostMethod(url);
post.setRequestHeader("content-type", "application/x-www-form-urlencoded");
NameValuePair[] pare = new NameValuePair[]{new NameValuePair("class","FtpAgereementInfoCache")};
post.setRequestBody(pare);
client.executeMethod(post);
在另请求的jsp中用String[] className = request.getParameterValues("class");获取数据得到的是null,
不过有些门户可以收到,有些门户收不到。为什么????
请求数据时你试试这个方法
StringEntity reqEntity = new StringEntity("class=FtpAgereementInfoCache");
// 设置类型
reqEntity.setContentType("application/x-www-form-urlencoded");
// 设置请求的数据
postMethod.setEntity(reqEntity);
//执行请求
httpclient.execute(postMethod);
:o [code="java"]
不过有些门户可以收到,有些门户收不到。
[/code]
这个什么意思?post url 是其它门户?
如果这样 你怎么又jsp 获得请求数据?
不懂
这个就奇怪了, :oops:
不应该这个情况啊