java.lang.IllegalStateException: getOutputStream() has already been called for this response
来源:互联网 发布:同志交友软件排行 编辑:程序博客网 时间:2024/04/29 11:05
下载文件产生异常:
java.lang.IllegalStateException: getOutputStream() has already been called for this response
response.getWriter()和response.getOutputStream()相冲突造成的
// 通过response的输出流把工作薄的流发送浏览器形成文件OutputStream outStream=null;try{outStream = response.getOutputStream();workBook.write(outStream);outStream.flush();}catch(Exception e){e.printStackTrace();}finally{if(outStream!=null){outStream.close();}if(workBook!=null){workBook.close();}}
在Controller层返回null,切记一定要返回null!有些人总觉得是流未关闭,关闭流之后依旧抛出该异常
public ModelAndView excelParse(@RequestParam(value="excelFile",required=false) MultipartFile file,HttpServletRequest request,HttpServletResponse response) throws Exception{ModelAndView view=new ModelAndView("ownerinfo/owner_import");<span style="white-space:pre"></span>ownerImportService.ownerImport(is,response,request);<span style="white-space:pre"></span>return null;
0 0
- 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
- 验证码异常: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完美解决方案
- struts2: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
- UFONet —— 一款开放的DDoS重定向攻击工具
- iOS中用到的3DES密码算法
- ListView-ArrayAdaptor
- php实现验证码的识别(中级篇)
- Java面试题全集(中)
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- SVN和Git的比较
- 蓝鸥Unity开发基础——析构方法
- zookeeper原理
- 160.Find the Difference
- iOS下的DES加密
- leetcode
- nginx grok 正则错误的输出情况
- 超级表格企业版:服务上万家中小企业,提升效率