1 一半图片都是把路径存放在数据库的 到时候取出路径就可以了
2 在数据库有blob格式可以存放图片 以二进制流的方式取出来
<% String zjbm = CheckParam(request.getParameter("zjbm"),""); String zpSql = "select zp from tjjryxxx where sfzh = '"+zjbm+"'"; out.clear(); response.setContentType("image/jpeg"); response.setHeader("Content-Transfer-Encoding","base64"); Connection connection = null; PreparedStatement ps = null; ResultSet rs = null; Blob blob =null; byte[] data = null; try{ connection =getConn(); ps = connection.prepareStatement(zpSql); rs = ps.executeQuery(); while(rs.next()){ blob = (Blob)rs.getBlob("zp"); long nlen = blob.length(); int nsize = (int) nlen; data = blob.getBytes(1,nsize); OutputStream out1 = response.getOutputStream(); BufferedOutputStream bos =null; bos = new BufferedOutputStream(out1); bos.write(data,0,data.length); bos.close(); rs.close(); } }catch(Exception e){ e.printStackTrace(); } %>
温馨提示:答案为网友推荐,仅供参考