java.lang.IllegalStateException: getOutputStream() has already been called 解决办法
来源:互联网 发布:阿里云国际版注册攻略 编辑:程序博客网 时间:2024/05/21 08:37
今天上班做从数据库查询图片到jsp页面显示,结果报java.lang.IllegalStateException: getOutputStream() has already been called 错误,折腾了将近半天的时间才弄出来。
在网上查阅了很多资料基本上都是一家之言,虽然说得都对,不过没有源码。所以我写下来供大家查阅。废话不多说,直接贴代码:
1、jsp页面(注:我用的是springMVC)
<img style="margin-top: 100px;" alt="投诉举报流程图" src="${stream }">
2、后台java Action方法:
/**
* 投诉举报流程图
*
* @author wangmingyuan
* @return ModelAndView
* @serialData 2016年11月24日下午4:16:05
*/
@RequestMapping(value = "/complaintreportpicture")
public ModelAndView complaintreportpicture(String proId,HttpServletRequest request,HttpServletResponse response,Model model) {
Map<String, Object> vdata = new HashMap<String, Object>();
InputStream stream = wfComplaintReportService.findProcessPic("1");
try {
OutputStream output=response.getOutputStream();
int len=-1;
byte[]buf=new byte[1024];
while((len=stream.read(buf,0,1024))!=-1){
output.write(buf,0,len);
}
model.addAttribute("stream",stream);
output.flush();
return null;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return super.load("workflow/complaintreport/complaint_picture", vdata);
}
以上经过测试没问题!!
- java.lang.IllegalStateException: getOutputStream() has already been called 解决办法
- java.lang.IllegalStateException: getOutputStream() has already been called
- java.lang.IllegalStateException: getOutputStream() has already been called for t
- java.lang.IllegalStateException: getOutputStream() has already been called 解决方法
- java.lang.IllegalStateException: getOutputStream() has already been called f
- java.lang.IllegalStateException: getOutputStream() has already been called f
- java.lang.IllegalStateException: getOutputStream() has already been called for t
- java.lang.IllegalStateException: getOutputStream() has already been called for this response的解决办法
- java.lang.IllegalStateException: getOutputStream() has already been called for this respons解决办法
- 生成验证码页面 报 java.lang.IllegalStateException: getOutputStream() has already been called 解决办法
- java.lang.IllegalStateException: getOutputStream() has already been called for this response,java.la
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException:getOutputStream() has already been called for this response的解决方法
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- 验证码异常:java.lang.IllegalStateException: getOutputStream() has already been called for this response
- django中创建应用app并修改模型
- Lua 协同程序(coroutine)
- HTML5 Canvas 画图标签 & 画线,圆,渐变色
- HTML5 移动端div块跟随手指拖动
- CentOS+Apache2+Python+MySQLdb
- java.lang.IllegalStateException: getOutputStream() has already been called 解决办法
- 通过项目逐步深入了解Mybatis(四)
- 回环变位
- SpringMVC出现406错误的解决办法
- list.h说明
- the celebration regarding
- test2 live
- android 常用时间格式转换代码
- 火狐如何兼容反斜杠