@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; "/>
posted on 2017-06-06 16:48  仰望天空的小鸟  阅读(2755)  评论(0编辑  收藏  举报