我尝试从Oracle数据库访问图像数据并在jsp上显示图像。写下面的代码。 在Oracle数据库中的图像数据时在JSP中显示图像图像
<%
try
{
ResultSet rs=stmt.executeQuery("select * from PICTABLE where ID=200");
if(rs.next())
{
Blob b1=rs.getBlob("PIC");
byte x[]=b1.getBytes(1, (int)b1.length());
OutputStream o=response.getOutputStream();
o.write(x);
o.close();
}
System.out.println("Done");
}
catch(Exception ex)
{
ex.printStackTrace();
}
%>
当运行此代码并使用IE浏览器,然后显示图像有错误
[java.lang.IllegalStateException: getOutputStream() has already been called for this response] with root cause
java.lang.IllegalStateException: getOutputStream() has already been called for this response
当使用铬浏览器,然后图像数据不转换图像格式和以上大厦错误发生。如何为每个浏览器解决这个问题。