<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "如何將.jsp檔案輸出成圖片?"]]></title>
		<link>https://forum.andowson.com/posts/list/5.page</link>
		<description><![CDATA[Latest messages posted in the topic "如何將.jsp檔案輸出成圖片?"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>如何將.jsp檔案輸出成圖片?</title>
				<description><![CDATA[ 這URL會連到一個動態的圖片 http://目錄名/A.jsp 
<br>
<br>
有辦法將A.jsp當成是圖片檔,然後包含到B.jsp中輸出嗎? 
<br>
假設我在B.jsp這檔案裡,有辦法使用如下的方法嗎? 
<br>
[code]&lt;table&gt; 
<br>
 &lt;tr&gt; 
<br>
 &lt;td&gt;&lt;img src="http://目錄名/A.jsp "&gt;&lt;/td&gt; 
<br>
 &lt;/tr&gt; 
<br>
&lt;/table&gt;[/code] 
<br>
<br>
JavaScript 
<br>
[code]&lt;script language='JavaScript' type='text/javascript' src='http://目錄名/A.jsp '&gt;&lt;/script&gt;[/code] 
<br>
HTML 
<br>
[code]&lt;iframe frameborder='0' width='180' height='800' src='http://目錄名/A.jsp '&gt;&lt;/iframe&gt;[/code]如果不使用JavaScript及iframe ,還有其他方法可以做到如上兩段程式一樣的功能嗎? 
<br>]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/280/497.page</guid>
				<link>https://forum.andowson.com/posts/preList/280/497.page</link>
				<pubDate><![CDATA[Fri, 17 Oct 2008 13:05:47]]> GMT</pubDate>
				<author><![CDATA[ viva]]></author>
			</item>
			<item>
				<title>回覆:如何將.jsp檔案輸出成圖片?</title>
				<description><![CDATA[ 可以參考這一篇 
<br>
[url=http://fdegrelle.over-blog.com/article-992927.html]A simple way to display database blob stored image in a jsp[/url] 
<br>
要注意的重點就是， 
<br>
1.JSP頁面內不能有文字輸出，要全部用&lt;% ... %&gt;包圍起來，不能有HTML的標籤被輸出。 
<br>
2.ContentType要設定為image/gif, image/jpeg, ...。 
<br>
3.重新由response取得OutputStream，因原本的out物件是屬於文字輸出型的。 
<br>
[code] 
<br>
 // get the image from any source 
<br>
 byte[] imgData = getYourImage(); 
<br>
 // display the image 
<br>
 response.setContentType("image/gif"); 
<br>
 OutputStream o = response.getOutputStream(); 
<br>
 o.write(imgData); 
<br>
 o.flush(); 
<br>
 o.close(); 
<br>
[/code]]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/280/498.page</guid>
				<link>https://forum.andowson.com/posts/preList/280/498.page</link>
				<pubDate><![CDATA[Sat, 18 Oct 2008 08:57:01]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:如何將.jsp檔案輸出成圖片?</title>
				<description><![CDATA[ 請教一下....測試程式有3個 test1.jsp　，　test2.jsp ，　test3.jsp 
<br>
test1.jsp(已排版好的動態圖片) 
<br>
[code]&lt;table align="center"&gt; 
<br>
&lt;tr&gt;&lt;td align="center"&gt;&lt;img src="http://xxxxxx.gif"&gt;&lt;/td&gt;&lt;/tr&gt; 
<br>
&lt;tr&gt;&lt;td align="center"&gt;測試1&lt;/td&gt;&lt;/tr&gt; 
<br>
&lt;tr&gt;&lt;td align="center"&gt;&lt;img src="http://xxxxxx.gif"&gt;&lt;/td&gt;&lt;/tr&gt; 
<br>
&lt;tr&gt;&lt;td align="center"&gt;測試2&lt;/td&gt;&lt;/tr&gt; 
<br>
&lt;/table&gt;[/code] 
<br>
<br>
test2.jsp (發送GIF檔案給瀏覽器) 
<br>
[code]&lt;%@ page import="java.io.*" %&gt; 
<br>
&lt;%@ page import="java.util.*" %&gt; 
<br>
&lt;% 
<br>
 response.setContentType("image/gif"); 
<br>
 File f = new File("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\webapps\\ROOT\\test1.jsp"); 
<br>
 byte[] b = new byte[(int)f.length()]; 
<br>
 FileInputStream fis = new FileInputStream(f); 
<br>
 fis.read(b); 
<br>
<br>
 OutputStream os = response.getOutputStream(); 
<br>
 os.write(b); 
<br>
 os.flush(); 
<br>
%&gt;[/code] 
<br>
test3.jsp 
<br>
[code]&lt;%@ page contentType="text/html; charset=Big5" %&gt; 
<br>
&lt;table&gt; 
<br>
 &lt;tr&gt; 
<br>
 &lt;td&gt;&lt;img src="http://localhost:8080/test.jsp"&gt;&lt;/td&gt; 
<br>
 &lt;/tr&gt; 
<br>
&lt;/table&gt;[/code] 
<br>
<br>
測試時,連到http://localhost:8080/test2.jsp 可以看到test1.jsp的圖檔 
<br>
但連到http://localhost:8080/test3.jsp 卻無法顯示圖片 
<br>
連到test2.jsp 可以看到圖片的話不就代表test2.jsp是以GIF檔回應給瀏覽器 
<br>
為何在test3.jsp使用[color=red]&lt;img src="xxx.jsp"&gt;[/color]卻無法顯示?]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/280/499.page</guid>
				<link>https://forum.andowson.com/posts/preList/280/499.page</link>
				<pubDate><![CDATA[Sun, 19 Oct 2008 11:44:37]]> GMT</pubDate>
				<author><![CDATA[ viva]]></author>
			</item>
			<item>
				<title>回覆:如何將.jsp檔案輸出成圖片?</title>
				<description><![CDATA[ test2.jsp內的第五行 
<br>
[code]File f = new File("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\webapps\\ROOT\\test1.jsp");[/code] 
<br>
要改成 
<br>
[code]File f = new File("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\webapps\\ROOT\\images\\xxx.gif");[/code] 
<br>
<br>
test3.jsp的第四行應修正為： 
<br>
[code]&lt;td&gt;<img src="http://localhost:8080/test2.jsp">&lt;/td&gt;[/code]]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/280/500.page</guid>
				<link>https://forum.andowson.com/posts/preList/280/500.page</link>
				<pubDate><![CDATA[Sun, 19 Oct 2008 19:54:18]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:如何將.jsp檔案輸出成圖片?</title>
				<description><![CDATA[ 感謝指導!! 
<br>
test2.jsp內的第五行改為.gif檔後,在test3.jsp可以由[color=red]&lt;img src="http://localhost:8080/test2.jsp"&gt;[/color]顯示 
<br>
<br>
<br>
但因test1.jsp裡,圖片不只一張,而且還有JAVA語言去做動態圖片的選擇! 
<br>
<br>
所以在test2.jsp內的第五行一定只能讀.gif檔嗎? 沒辦法讀整個test1.jsp檔嗎? 
<br>
[code]File f = new File("C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\webapps\\ROOT\\images\\xxx.gif"); [/code] 
<br>
<br>
<br>
<br>]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/280/501.page</guid>
				<link>https://forum.andowson.com/posts/preList/280/501.page</link>
				<pubDate><![CDATA[Mon, 20 Oct 2008 12:06:09]]> GMT</pubDate>
				<author><![CDATA[ viva]]></author>
			</item>
			<item>
				<title>回覆:如何將.jsp檔案輸出成圖片?</title>
				<description><![CDATA[ 請先確認test3.jsp一次要顯示幾張圖?這些圖放在哪邊？然後跟test1.jsp有什麼關係？ 
<br>
也許你需要的只是在test3.jsp中使用&lt;jsp:include page="test1.jsp" /&gt;]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/280/502.page</guid>
				<link>https://forum.andowson.com/posts/preList/280/502.page</link>
				<pubDate><![CDATA[Mon, 20 Oct 2008 12:35:22]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:如何將.jsp檔案輸出成圖片?</title>
				<description><![CDATA[ 其實主要要使用的語法就只有[color=red]&lt;img src="http://xxxx/test1.jsp"&gt;[/color] 
<br>
test3.jsp只是測試時我想看結果而已! 
<br>
圖的話,在伺服器上,用http://xxxxx/.gif去使用! 
<br>
而test1.jsp是經由某個介面輸入要顯示幾張圖片後而出現的結果!! 
<br>
其實就是個圖片工具而已,只是有些網站限制了Javascript跟iframe 
<br>
所以才想用[color=red]&lt;img src="http://xxxx/test1.jsp"&gt;[/color]的方法!! 
<br>
<br>
請問... 
<br>
我把test1.jsp整個HTML TAG存在StringBuffer裡,轉為String後再讀出byte! 
<br>
再利用前述方法response.setContentType("text/html;charset=BIG5");傳回HTML 
<br>
<br>
在前述例子可用&lt;img src="http://xxx/test2.jsp"&gt;顯示出來! 
<br>
那有相關方法可以使用TAG秀出http://xxx/test4.jsp的HTML的嗎? 
<br>
<br>
test4.jsp 
<br>
[code]&lt;%@ include file="inc_common_parameters.jsp" %&gt; 
<br>
&lt;%@ include file="inc_common_fun_doc.jsp" %&gt; 
<br>
&lt;% 
<br>
 response.setContentType("text/html;charset=BIG5"); 
<br>
 HttpUtil a = new HttpUtil(); 
<br>
 StringBuffer sb = null; 
<br>
 try { 
<br>
 sb = a.doPost("http://xxx/test1.jsp", "", "UTF-8");//傳回整個htm放到sb 
<br>
 String sb_t = sb.toString(); 
<br>
 byte[] b = sb_t.getBytes(); 
<br>
 OutputStream os = response.getOutputStream(); 
<br>
 os.write(b); 
<br>
 os.flush(); 
<br>
 } catch(Exception e) { 
<br>
 out.println(e.getMessage()); 
<br>
 }[/code] 
<br>
<br>
<br>]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/280/503.page</guid>
				<link>https://forum.andowson.com/posts/preList/280/503.page</link>
				<pubDate><![CDATA[Mon, 20 Oct 2008 13:19:19]]> GMT</pubDate>
				<author><![CDATA[ viva]]></author>
			</item>
			<item>
				<title>回覆:如何將.jsp檔案輸出成圖片?</title>
				<description><![CDATA[ 不知道您的需求是不是如下： 
<br>
網站A，動態產生廣告圖片網頁test1.jsp，內容為文字HTML標籤 
<br>
網站B，只能放HTML的靜態網頁空間，想要將網站A的test1.jsp的結果顯示在一個網頁，例如showTest1.html上 
<br>
可行的作法是在網站B上使用&lt;frame&gt;或&lt;iframe&gt;或者&lt;javascript&gt;的src屬性去設定來源URL為網站A的test1.jsp 
<br>
現在您是指，如果不使用上面這幾個標籤時，可以改用img的src屬性來達成嗎？]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/280/504.page</guid>
				<link>https://forum.andowson.com/posts/preList/280/504.page</link>
				<pubDate><![CDATA[Mon, 20 Oct 2008 19:46:32]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:如何將.jsp檔案輸出成圖片?</title>
				<description><![CDATA[ [quote=andowson] 
<br>
網站A，動態產生廣告圖片網頁test1.jsp，內容為文字HTML標籤 
<br>
網站B，只能放HTML的靜態網頁空間，想要將網站A的test1.jsp的結果顯示在一個網頁，例如showTest1.html上 
<br>
可行的作法是在網站B上使用&lt;frame&gt;或&lt;iframe&gt;或者&lt;javascript&gt;的src屬性去設定來源URL為網站A的test1.jsp 
<br>
[/quote] 
<br>
<br>
是的,你說明是我原本的作法....我的疑問也是您所說的,是否可改用img的src屬性來達成？ 
<br>
<br>
我在想乾脆用[color=red]img src="http://............檔名.jsp"[/color],前端連結固定 
<br>
然後利用後端程式與資料庫來做出動態效果....只不過有點麻煩!code也要重寫,所以想請教是否還有其他方法? 
<br>
<br>
因已有現成且處理好的程式(網站A),也有程式可以讀取網站A的HTML程式碼(test4.jsp) 
<br>
那該怎麼在網站B的靜態網頁空間中顯示出來? 
<br>
<br>]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/280/505.page</guid>
				<link>https://forum.andowson.com/posts/preList/280/505.page</link>
				<pubDate><![CDATA[Tue, 21 Oct 2008 14:27:46]]> GMT</pubDate>
				<author><![CDATA[ viva]]></author>
			</item>
			<item>
				<title>回覆:如何將.jsp檔案輸出成圖片?</title>
				<description><![CDATA[ 有種方法，不知道管不管用，做張網頁截圖，例如 
<br>
[img]http://happy.ppt.cc/0/b/5/src_0b51e10a876109e1087ca7081f4b9ce2.png[/img] 
<br>
可以利用下列網址產生 
<br>
http://ppt.cc/yo2/index.php 
<br>
然後你再將該截圖抓回來放到你的網站上去 
<br>
再把img src的來源指到你的網站上]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/280/506.page</guid>
				<link>https://forum.andowson.com/posts/preList/280/506.page</link>
				<pubDate><![CDATA[Thu, 23 Oct 2008 13:31:43]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:如何將.jsp檔案輸出成圖片?</title>
				<description><![CDATA[ 哇賽....那個快照網站好屌喔!原來還有那種東西....
<br>
<br>
剛試了一下,發覺那個是用靜態網頁
<br>
我的圖片工具,圖片全部都動態的,畫面會自行跳動,所以快照不適合!
<br>
<br>
我後來想想,還是使用你指導的,順便夾帶個參數[color=red]&lt;img src="http://xxxx/test2.jsp?TYPE=參數"&gt;[/color]
<br>
然後再從test2.jsp裡去判斷參數多少,然後給予相對應的圖片!!
<br>
<br>
最傷腦筋的就是排版......呼!!
<br>
<br>
謝謝andowson大力指導^^]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/280/507.page</guid>
				<link>https://forum.andowson.com/posts/preList/280/507.page</link>
				<pubDate><![CDATA[Thu, 23 Oct 2008 13:52:26]]> GMT</pubDate>
				<author><![CDATA[ viva]]></author>
			</item>
	</channel>
</rss>