PostMethod postMethod = new PostMethod(url);
RequestEntity requestEntity = new StringRequestEntity(requestData,""text/xml"","gbk")
postMethod.setRequestEntity(requestEntity);
int httpReturnCold = httpClient.executeMethod(postMethod);如上述代码,如果url=“http://localhost:8080/text_xml/test.do"我想问下,我把requestData数据提交到这个歌url后,这个url该怎么获取提交过来的数据哦?
RequestEntity requestEntity = new StringRequestEntity(requestData,""text/xml"","gbk")
postMethod.setRequestEntity(requestEntity);
int httpReturnCold = httpClient.executeMethod(postMethod);如上述代码,如果url=“http://localhost:8080/text_xml/test.do"我想问下,我把requestData数据提交到这个歌url后,这个url该怎么获取提交过来的数据哦?
解决方案 »
- java 打包成jar的问题
- 再问简单问题(立即给分)
- 急呀!求救,散分,反编译的一个CLASS文件,怎样把它编辑成可用的代码
- ???關於STRUTS MULTIBOX怎麼使用?有誰知道嗎?幫幫忙啦
- 各位大虾,请帮帮忙,关于REPLACE函数的问题
- JAVA编码,用EUC-CN读取UTF-8后,再用UTF-8写回覆盖原文文件,是否该文件就损坏了?
- 请问怎么把gif格式的文件转换成png格式的文件?
- java怎样生成可执行文件?
- 求一验证Email地址合法性的程序
- Java if里面的return和if外面的return到底返回的是哪个值?
- android--退出问题(急用,在线等)
- static class Builder的static不能少,这是为什么?
RequestEntity requestEntity = new StringRequestEntity(requestData,""text/xml"","gbk")
postMethod.setRequestEntity(requestEntity);
int httpReturnCold = httpClient.executeMethod(postMethod);String responseBody = postMethod.getResponseBodyAsString();如上述代码,如果url=“http://localhost:8080/text_xml/test.do"我想问下,我把requestData数据提交到这个url后,这个url该怎么获取提交过来的数据requestData哦?
lz先搞懂test.do是个什么东西。
然后在doGet,doPost方法里面取得参数,调用相关服务。
最后返回结果,在页面中渲染。
+ entity.getContentEncoding() + "---"
+ entity.getContentLength());
InputStream inputStream = entity.getContent();
byte[] b = new byte[1024];
StringBuilder builder = new StringBuilder();
while (inputStream.read(b) != -1) {
builder.append(new String(b, "utf-8"));
}
System.out.println(builder.toString().trim());