日期:2014-05-18  浏览次数:20631 次

怎么在jsp中显示oracle数据库中的blob字段,解决好了另有100分送上.
如题:
我现在已经存入到数据库中了,但是无法显示,

blob内容为图片.
谢谢各位大侠!!
最好有代码

------解决方案--------------------
不懂的~~~回复了有分么~??????????
------解决方案--------------------
如果是图片的话: <IMG src= "../showpicture.do " id= "pic " width= "160px " height= "200px " border= "0 "> “showpicture.do”是将文件写入输出流的操作 ,提供部分代码吧
if (blob != null) {
InputStream is = blob.getBinaryStream();
byte[] b = new byte[Integer.parseInt(String.valueOf(blob.length()))];
BufferedOutputStream os = new BufferedOutputStream(out);
is.read(b);
os.write(b);
if (is != null) {
is.close();
}
if (os != null) {
os.close();
}
}
其中blob为BLOB对象实例,out是ServletOutputStream类型,你写servlet也好,用struts也罢,剩下的应该没问题了吧。