图片以byte形式存在数据库中
/**
* 读取图片
* @description
* @return Map<String,Object>
* @throws
*/
@RequestMapping(value = "/file/getfile")
public void getload(HttpServletRequest request,
HttpServletResponse response, HttpSession session,String pkId){
assFileContent = new AssFileContent();
try {
byte[] img = assFileContentService.findAssFileContent(pkId).getFileContent();
response.reset();
response.setContentType("image/jpeg");
response.getOutputStream().write(img);
response.getOutputStream().close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
getFileContent()为图片文件
jsp页面展示图片直接调用地址