我想要从数据库中读取图片,然后返回到页面。代码如下:
String imgId = this.getPara("imgId");
logger.debug("imgId={}", imgId);
HttpServletResponse response = this.getResponse();
response.setContentType("image/jpeg");
ServletOutputStream outputStream = null;
try {
outputStream = response.getOutputStream();
byte[] img = termImgService.getImgById(imgId);
outputStream.write(img);
outputStream.flush();
} catch (IOException e) {
logger.error("查询图片方法异常!", e);
}finally{
if (null != outputStream) {
try {
outputStream.close();
renderNull();
} catch (IOException e) {
logger.error("查询图片方法异常!", e);
}
}
}已经加上了renderNull(),还是报错了。

项目:JFinal