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
相关问答:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
问题描述:
例如我要显示的内容如下所示
一级目录1
一级目录1子类1
子类1
一级目录1子类2
......
我JSP的页面是:
<%@ page language="java" contentType="text/html; charset=gb2312"
%>
<script>
function Save(){
xmlHttp=GetXmlHttpObject()
if(xmlHttp==nul ......
最近一个项目中遇到一个问题:在原有的一套系统中(php开发)添加一些小功能(jsp开发),原来用户系统都是php开发的,我如何在jsp开发的功能中做到用户信息session同步呢? 有人是否有做过类以项目,想听听大家的看法
......
大家好,我在JSP的初学者,在编程中遇到了一个问题:
<jsp:useBean id="accountBiz" class="bank.AccountBiz"
scope="application">
这个标签中application和sessi ......