![]() |
<table>
<tr>
<td><img src="http://目錄名/A.jsp "></td>
</tr>
</table>
<script language='JavaScript' type='text/javascript' src='http://目錄名/A.jsp '></script>
<iframe frameborder='0' width='180' height='800' src='http://目錄名/A.jsp '></iframe>
如果不使用JavaScript及iframe ,還有其他方法可以做到如上兩段程式一樣的功能嗎?
// get the image from any source
byte[] imgData = getYourImage();
// display the image
response.setContentType("image/gif");
OutputStream o = response.getOutputStream();
o.write(imgData);
o.flush();
o.close();
<table align="center">
<tr><td align="center"><img src="http://xxxxxx.gif"></td></tr>
<tr><td align="center">測試1</td></tr>
<tr><td align="center"><img src="http://xxxxxx.gif"></td></tr>
<tr><td align="center">測試2</td></tr>
</table>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%
response.setContentType("image/gif");
File f = new File("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\webapps\\ROOT\\test1.jsp");
byte[] b = new byte[(int)f.length()];
FileInputStream fis = new FileInputStream(f);
fis.read(b);
OutputStream os = response.getOutputStream();
os.write(b);
os.flush();
%>
<%@ page contentType="text/html; charset=Big5" %>
<table>
<tr>
<td><img src="http://localhost:8080/test.jsp"></td>
</tr>
</table>
File f = new File("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\webapps\\ROOT\\test1.jsp");
File f = new File("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\webapps\\ROOT\\images\\xxx.gif");
<td>
</td>
File f = new File("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\webapps\\ROOT\\images\\xxx.gif");
<%@ include file="inc_common_parameters.jsp" %>
<%@ include file="inc_common_fun_doc.jsp" %>
<%
response.setContentType("text/html;charset=BIG5");
HttpUtil a = new HttpUtil();
StringBuffer sb = null;
try {
sb = a.doPost("http://xxx/test1.jsp", "", "UTF-8");//傳回整個htm放到sb
String sb_t = sb.toString();
byte[] b = sb_t.getBytes();
OutputStream os = response.getOutputStream();
os.write(b);
os.flush();
} catch(Exception e) {
out.println(e.getMessage());
}
andowson wrote:
網站A,動態產生廣告圖片網頁test1.jsp,內容為文字HTML標籤
網站B,只能放HTML的靜態網頁空間,想要將網站A的test1.jsp的結果顯示在一個網頁,例如showTest1.html上
可行的作法是在網站B上使用<frame>或<iframe>或者<javascript>的src屬性去設定來源URL為網站A的test1.jsp