求助:如何使用输入输出流不保存在本地直接将图片显示在jsp页面上
@RequestMapping(value="/process/flow.rc")publicvoidflow(@RequestParamStringprocessId,...
@RequestMapping(value="/process/flow.rc")
public void flow(@RequestParam String processId, HttpServletResponse response) throws IOException {
InputStream img = null;
try {
img = service.getProcessImage(processId);
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control",
"no-store, no-cache, must-revalidate");
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
response.setHeader("Pragma", "no-cache");
response.setContentType("image/png");
byte[] buff = new byte[1024];
while ( img.read(buff) != -1 ) {
response.getOutputStream().write(buff);
}
response.getOutputStream().flush();
} catch (Exception e) {
response.sendError(404);
} finally {
if ( img != null ) {
img.close();
}
}
}我这样为什么显示不出来,jsp页面需要怎么写,我只有这么多分了,谢谢了
今天突然发现不是这里的问题,是因为在DWZ框架上才无法显示,有会用DWZ框架吗 展开
public void flow(@RequestParam String processId, HttpServletResponse response) throws IOException {
InputStream img = null;
try {
img = service.getProcessImage(processId);
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control",
"no-store, no-cache, must-revalidate");
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
response.setHeader("Pragma", "no-cache");
response.setContentType("image/png");
byte[] buff = new byte[1024];
while ( img.read(buff) != -1 ) {
response.getOutputStream().write(buff);
}
response.getOutputStream().flush();
} catch (Exception e) {
response.sendError(404);
} finally {
if ( img != null ) {
img.close();
}
}
}我这样为什么显示不出来,jsp页面需要怎么写,我只有这么多分了,谢谢了
今天突然发现不是这里的问题,是因为在DWZ框架上才无法显示,有会用DWZ框架吗 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询