@RequestMapping("/getPictureForpeople")public void getPictureForpeople(HttpServletRequest request, HttpServletResponse response) throws IOException, SQLException { Connection conn = null; conn = GetJDBCConnection.getJDBCConnection(); Statement stmt = conn.createStatement(); String getPicSQL = "select header from lc0039999.idmidentityinfo where code = ‘houzt‘"; ResultSet rs = stmt.executeQuery(getPicSQL); Blob img=null; if(rs.next()) { img = rs.getBlob("header"); } long size=img.length(); byte[] bs=img.getBytes(1, (int)size); // response.setContentType("image/jpeg"); ServletOutputStream outs=response.getOutputStream(); outs.write(bs); outs.flush();}
<img src="${ctx}/PersonPages/getPictureForpeople" style="width: 100px;height:120px;border:5px solid #104365;clear: both; display: block; margin:auto; "/>
时间: 2024-10-08 01:50:41