主题:JSP调用Servlet显示图片,显示不出来...
listdao = new WareListDao();
InputStream is = listdao.getStream(num);//从数据库中获取图片
//图片存储类型image,调试过能获取到
//rs.getBinaryStream("picture");
int i = is.available();//报异常,java.io.IOException: [Microsoft]
//[SQLServer 2000 Driver for JDBC]Object has been
//closed.
byte data[] = new byte [i];
is.read(data);
is.close();
response.setContentType("image/*");OutputStream toClient =response.getOutputStream();
toClient.write(data);
toClient.close();
InputStream is = listdao.getStream(num);//从数据库中获取图片
//图片存储类型image,调试过能获取到
//rs.getBinaryStream("picture");
int i = is.available();//报异常,java.io.IOException: [Microsoft]
//[SQLServer 2000 Driver for JDBC]Object has been
//closed.
byte data[] = new byte [i];
is.read(data);
is.close();
response.setContentType("image/*");OutputStream toClient =response.getOutputStream();
toClient.write(data);
toClient.close();