byte[]ÔÚjspÒ³ÃæÏÔʾͼƬÎÊÌâ
HTML code:
<%@ page contentType="text/html; charset=GBK" language="java"%>
<%@ page import="java.io.*"%>
<html>
<body>
<form name="form" method="post">
<%
String bb = (String) request.getSession().getAttribute("content");//µÃµ½º¬ÓÐͼƬµÄ×Ö·û´®
byte[] date = bb.getBytes();
%>
<table>
<tr>
<td>
<%
response.setContentType("image/jpeg");
OutputStream toClient = response.getOutputStream();
InputStream in = new ByteArrayInputStream(date);
int len;
byte[] buf = new byte[1024];
while ((len = in.read(buf, 0, 1024)) != -1) {
toClient.write(buf, 0, len);
}
toClient.close();
%>
</td>
</tr>
</table>
</form>
</body>
</html>
ÔÚÕâ¸öjspÒ³ÃæÖУ¬ÎÒ´ÓsessionÖн«×Ö·û´®Í¼Æ¬È¡³öÀ´²¢×ª»¯Îªbyte[]Êý¾ÝÏÔʾÔÚjspÒ³ÃæÖС£ÏÖÔÚ×Ö·û´®Í¼Æ¬Êý¾ÝÒѾȡ³öÀ´£¬¿ÉÏÔʾͼƬµÄʱºò±¨Õâ¸ö´íÎó£º
ERROR 2009-10-13 09:55:47 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/BOSP].[jsp] Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: getOutputStream() has already been c
Ïà¹ØÎÊ´ð£º
JSPÒ³ÃæÖÐÓжà¸öradio°´Å¥
JSPÒ³Ã潫²ÎÊýPOST¸øservlet
ÒªÇóÈçÏÂ;
1.Ñ¡ÔñÒ»¸öradio£¬µ÷ÓÃservlet servletÖиù¾Ý²ÎÊýµ÷ÓÃÆäËû½Ó¿Ú£¬³ý·ÇÑ¡ÖиÃradio²¢µã»÷JSPÖеÄʵР......
JSPÖÐÒª´ÓÊý¾Ý¿âÀïÃæ¶ÁÈ¡Êý¾Ý ÿҳÏÔʾ5ÌõÊý¾Ý£¬Òª½øÐзҳ£¬»¹Òª·µ»ØÇ°Ò»Ò³ ¸ÃÔõôʵÏÖ°¡
ÓõÄʲôÊý¾Ý¿âÄØ£¿£¿£¿
MYSQL
....лл ÎÒÏÈ¿´¿´´úÂë
http://my.donews.com/benz/2006/10/21/YnmQXKsKWNgKiTJ ......
ÎÊÌâ: ÏÖÔÚÌá½»Ö®ºó¾Í²»ÄÜÌøµ½ajax.jsÖÐÖ¸¶¨µÄservlet
¶øÊÇÓÖÖØнøÈëµ½ÁËpub_hotel_t.jspÒ³Ãæ. Ò²¾ÍÊÇûÓÐÖ´Ðе½ajaxÀïÃæÈ¥ ´ó¼Ò°ïæ¿´¿´ÊÇʲôÔÒò°É.
ÊDz»ÊǺÍÌá½»µÄ°´Å¦ÓйØÄ ......
µÚÒ»¸ö£ºjsp×ö½Øͼ¼òµ¥£¬»¹ÊÇasp×ö½Øͼ¼òµ¥£¡
µÚ¶þ¸ö£ºÎÒʹÓÃjsp½Øͼ£¬jsp½ØͼÔÚ·þÎñÆ÷¶Ë½Øͼ£¬²»ÊÇÔÚ¿Í»§¶Ë½Øͼ£¬ÎÒÒªµÄÊÇ¿Í»§¶Ë½Øͼ£¡
¾ÍÏ൱ÓëQQ½ØͼһÑù£¬½ØÍêͼ²¢°üͼƬµÄÐÅÏ¢±£´æÔÚÊý¾Ý¿âÖУ¬È»ºóÏÔʾÔÚÒ³Ãæ ......
¸÷λ´óÏÀ£¬Ð¡µÜæå¶Û£¬ÇëÈÏÕæ»Ø´ð£¡Ð»Ð»
ÓÐÁ½¸öÏÂÀÑ¡Ôñ¿ò£¬µÚÒ»¸öÑ¡Ôñ´óÀ࣬µÚ¶þ¸öÑ¡ÔñСÀ࣬Á½¸öÏÂÀÑ¡Ôñ¿òµÄÑ¡ÏîÈ«¶¼´ÓÊý¾Ý¿â²é³öÀ´¡£ÄÇôÔÚµÚÒ»¸öÑ¡Ôñ¿ò×ö³öÑ¡ÔñºóÈçºÎ°ÑÑ¡ÔñµÄÖµ´«¸øµÚ¶þ¸öÑ¡Ôñ¿òºÃÈõڶþ¸öÑ¡Ôñ ......