参考网址:http://guoyiqi.javaeye.com/blog/75929
showpic.jsp部分代码:
while (rs.next())
{
InputStream in = rs.getBinaryStream("picfile");
ServletOutputStream sos = response.getOutputStream();
int len = 0;
byte[] b = new byte[1024];
response.reset();
response.setContentType("image/gif");
while((len = in.read(b)) > 0)
sos.write(b,0,len);
in.close();
sos.close();
out.clear();
out = pageContext.pushBody();
}
红色标识部分是之后添加进去的,加了红色部分代码就没有异常了