JSPCN主页 | JSP空间 | 网站制作 | JSP下载 | JSP论坛 | JSP教程 | 关于JSPCN | 联系我们
JSP虚拟主机,jsp空间,java空间,java虚拟空间,详细请点击进入
做最专业的JSP中文网站 当前位置首页--JAVA技术--声音图片  
文章搜索:
关键字 标题
  
JSP中文网内容管理系统(JCMS)
JSP虚拟主机
网络笔记本
网摘,图片,笔记收藏
虚拟服务器

JSPCN文章目录分类
JSP配置[219]JSP基础[136]
中文问题[69]上传问题[27]
JAVABEAN[46]数据库[212]
文件操作[126]图片声音[17]
JSP其他[57]时间相关[16]
JAVAMAIL[72]STRUTS[144]
开发工具[28]教程系列[157]
JSP实例[89]
JAVA基础[421]APPLET[78]
JAVA网络[179]Applica[115]
Servlet[98]XML[163]
J2ME[257]J2EE[374]
考试相关[63]JAVA线程[90]
EJB[261]Swing[26]
Java API[141]声音图片[28]
异常处理[33]JAVA实例[290]
JAVA类[139]SUN[89]
Hibernate[6]JMX[8]
Spring[34]
本版推荐文章 
本版热点文章 
相关文章链接 
 
从数据库读出的JPG文件的字符流,转换成图片显示在页面上的相关?
作者:未知     文章来源:www.jspcn.net
访问次数:994次     加入时间:2005年01月19日
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { ServletOutputStream out = res.getOutputStream(); Statement dispStmt = null, setStmt = null; try { dispStmt = Con.createStatement(); setStmt = Con.createStatement(); setStmt.executeUpdate("set textsize 2048000"); } catch (Exception e) { out.println("Create Statement error:" + e.toString() + "<br>"); } String ls_sql = null; ls_sql = req.getParameter("ImageSQL"); if (ls_sql == null) ls_sql = ""; ls_sql = ls_sql.trim(); if (!ls_sql.equals("")) { ResultSet rs = null; try { rs = dispStmt.executeQuery(ls_sql); } catch (Exception e) { System.out.println( "Unable to Exec Statment" + e.toString() + "<br>"); } try { while (rs.next()) { try { res.setContentType("image/jpeg"); InputStream is = rs.getBinaryStream(1); int size = is.available(); byte[] bzp = new byte[size]; is.read(bzp); out.write(bzp); } catch (Exception e) { System.out.println("Wirte image error: " + e.toString()); } } rs.close(); } catch (Exception e) { System.out.println("Unable to Close Statment" + e.toString()); } } try { dispStmt.close(); } catch (Exception e) { System.out.println("Close Statement Error: " + e.toString()); } out.close();} 
Copyright © 2002-2005 JSPCN.net. All rights reserved.
JSP中文网    备案序号:蜀ICP备05001583号
成都恒海科技发展有限公司    成都市一环路南二段6号新瑞楼三楼8号