比如在a.jsp中动态包含http://www.baidu.com/s?wd=%BE%C8%C3%FC&oq=jiuming&f=3&rsp=0中的内容,参数值是动态变化的,用include不行,
向各位求解,先谢过
10 个解决方案
#1
动态的就用<jsp:include>呀
#2
如果在jsp页面中写下面的代码
<body>
This is my JSP page. <br>
<jsp:include flush="true" page="http://127.0.0.1:8852"></jsp:include>
</body>
会在打开的网页上显示
This is my JSP page.
The requested resource (/test/http:/127.0.0.1:8852) is not available
我想将新申请的页面也包含进来,那该如何做呢?
请各位帮帮忙
<body>
This is my JSP page. <br>
<jsp:include flush="true" page="http://127.0.0.1:8852"></jsp:include>
</body>
会在打开的网页上显示
This is my JSP page.
The requested resource (/test/http:/127.0.0.1:8852) is not available
我想将新申请的页面也包含进来,那该如何做呢?
请各位帮帮忙
#3
需要读入“http://www.baidu.com/s?wd=%BE%C8%C3%FC&oq=jiuming&f=3&rsp=0”内容,然后写入jsp。
#4
路径有问题,可以用struts或者servlet请求转发,动态获得jsp:include page属性的值
#5
用<jsp:include >就可以了
#6
<%@include %>指令是静态包含,必须在页面编译期就要知道被包含页面的内容了。
你那种是动态包含,只能用<jsp:include />
String path = "";//这里是你的路径
<jsp:include flush="true" page="<%=path%>"></jsp:include>
你那种是动态包含,只能用<jsp:include />
String path = "";//这里是你的路径
<jsp:include flush="true" page="<%=path%>"></jsp:include>
#7
UP
#8
请问怎么读入这个页面的信息啊?
#9
jsp:include的路径是不允许包含外部的URL的,干脆iframe算了
#10
简单。
String pageContent = readUrl("http://www.baidu.com/s?wd=%BE%C8%C3%FC&amp;amp;oq=jiuming&amp;amp;f=3&amp;amp;rsp=0");
public String readUrl(String urlString) {
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(
new InputStreamReader(
url.openStream()));
String inputLine;
String urlBuf = new StringBuffer();
while ((inputLine = in.readLine()) != null)
urlBuf.append(inputLine).append("\r\n");
in.close();
return urlBuf.toString();
}
#1
动态的就用<jsp:include>呀
#2
如果在jsp页面中写下面的代码
<body>
This is my JSP page. <br>
<jsp:include flush="true" page="http://127.0.0.1:8852"></jsp:include>
</body>
会在打开的网页上显示
This is my JSP page.
The requested resource (/test/http:/127.0.0.1:8852) is not available
我想将新申请的页面也包含进来,那该如何做呢?
请各位帮帮忙
<body>
This is my JSP page. <br>
<jsp:include flush="true" page="http://127.0.0.1:8852"></jsp:include>
</body>
会在打开的网页上显示
This is my JSP page.
The requested resource (/test/http:/127.0.0.1:8852) is not available
我想将新申请的页面也包含进来,那该如何做呢?
请各位帮帮忙
#3
需要读入“http://www.baidu.com/s?wd=%BE%C8%C3%FC&oq=jiuming&f=3&rsp=0”内容,然后写入jsp。
#4
路径有问题,可以用struts或者servlet请求转发,动态获得jsp:include page属性的值
#5
用<jsp:include >就可以了
#6
<%@include %>指令是静态包含,必须在页面编译期就要知道被包含页面的内容了。
你那种是动态包含,只能用<jsp:include />
String path = "";//这里是你的路径
<jsp:include flush="true" page="<%=path%>"></jsp:include>
你那种是动态包含,只能用<jsp:include />
String path = "";//这里是你的路径
<jsp:include flush="true" page="<%=path%>"></jsp:include>
#7
UP
#8
请问怎么读入这个页面的信息啊?
#9
jsp:include的路径是不允许包含外部的URL的,干脆iframe算了
#10
简单。
String pageContent = readUrl("http://www.baidu.com/s?wd=%BE%C8%C3%FC&amp;amp;oq=jiuming&amp;amp;f=3&amp;amp;rsp=0");
public String readUrl(String urlString) {
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(
new InputStreamReader(
url.openStream()));
String inputLine;
String urlBuf = new StringBuffer();
while ((inputLine = in.readLine()) != null)
urlBuf.append(inputLine).append("\r\n");
in.close();
return urlBuf.toString();
}