java怎么获取远程带参数的xml文件?
java怎么获取远程带参数的xml文件?
类似地址:
http://192.168.1.100/test.jsp?cindex=2&pagesize=2
如果没有带有参数的地址:像
http://192.168.1.100/test.xml就能获取。
楼上厉害。。
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
public class roXML {
public static void main(String[] args) {
try {
String url = "http://board2.finance.daum.net/gaia/do/xml/finance/read?bbsId=stock&articleId=1673473&pageIndex=1&viewObj=1:2:0";
URLConnection uc = new URL(url).openConnection();
uc.setConnectTimeout(10000);
uc.setDoOutput(true);
InputStream in = new BufferedInputStream(uc.getInputStream());
Reader rd = new InputStreamReader(in,"UTF-8");
StringBuffer temp = new StringBuffer();
String strHtml = null;
int c = 0;
while ((c = rd.read()) != -1) {
temp.append((char) c);
}
in.close();
strHtml = temp.toString();
} catch (MalformedURLException e) {
// TODO Auto-generated catch bloc
相关问答:
当知道一个日期,如何把这个日期所在旬的前后两个日期取出
比如输入20090905,就输入20090901 20090910
输出20090901 20090910
取得天数后作一下判断再把这个方法用下void set(int field, int value)
......
一个JSP页面接收其他页面提交过来的FORM表单,但是要求只接收当前站点及其子站点提交过来的FORM表单,其他站点提交过来的表单不接收,这个怎么设置?
用过滤器
filter
将当前站点及其子站点放一个目录
然 ......
在asp里怎么调用java写的webservice方法,有很多方法
- <message name="RtPnrIn">
<part name="bstrPnrNO" type="s:string" />
<part name ......
我已经按照教程上配置tomcat的server.xml
<Context path = "/POS" docBase = "POS" debug = "5" reloadable = "true" crossContext = "true" workDir = &quo ......
我JSP的页面是:
<%@ page language="java" contentType="text/html; charset=gb2312"
%>
<script>
function Save(){
xmlHttp=GetXmlHttpObject()
if(xmlHttp==nul ......