怎么把数据库(db2)中blob字段(图片)读出,并显示到jsp中?(来者有分) 读取blob类型的具体代码自己写吧,不难,转到jsp页面可以在servlet中把图片对象放到request中,再从jsp中读出来 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 kongxiangli(笑看红尘) 能不能说清楚一点?或连接的url? (转)这是调用servlet的在页面上你这样调用<src="DownLoad?id=">就可以了import java.sql.*;import java.io.*;import java.util.*;import javax.servlet.*;import javax.servlet.http.*;public class DownLoad extends HttpServlet{ public DownLoad() { } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("======DownLoad begin====="); try{ Class.forName("oracle.jdbc.driver.OracleDriver"); Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@10.216.0.2:1521:ORCL","dms","dms"); Statement stmt=conn.createStatement(); String id=request.getParameter("id"); String sql="SELECT id, name, content FROM zyw_test where id='"+id+"'"; ResultSet rs=stmt.executeQuery(sql); if(rs.next()){ Blob blob = rs.getBlob("content"); byte[] ab = blob.getBytes(1, (int)blob.length()); response.setContentType("image/jpeg"); ServletOutputStream op = response.getOutputStream(); op.write(ab); op.flush(); op.close(); } }catch(Exception ex){ ex.printStackTrace(); } System.out.println("======DownLoad end====="); }} ServletOutputStream op = response.getOutputStream();后怎么在我的mapid.jsp显示这个图片啊? jsp页面中加入<IMG height=99 src="servlet名称?id=<%=rs.getInt("id")%>" width=136></td>如上面的servlet名称:DownLoad jsp里面怎么调用本地outlook发送邮件且带附件,在线等 求s2sh 整合的文件配置 Hibernate copy记录 请问有没有稳定开源的网上商城的源码啊? 请问如何用记事本导入hibernate中的org.hibernate.*的包? 问一个JSP与MYSQL的小问题,请大家看看帮帮忙!!! RequestDispatcher.include的编码问题 淘宝的数据库搜索技术 救命啊!数据库操作错误,一直困扰无法解决啊! 高手指点指点(关于下拉菜单) eclipse的简单问题 读blob为什么出现这样的错? waitting。。。。
或连接的url?
后怎么在我的mapid.jsp显示这个图片啊?
如上面的servlet名称:DownLoad