SSH中发生异常java.lang.IllegalStateException: getOutputStream() has already been called for this response

来源:互联网 发布:如何判断淘宝号被黑 编辑:程序博客网 时间:2024/06/10 21:05

    下载文件的时候发生异常!

       java.lang.IllegalStateException: getOutputStream() has already been called for this response

    response这个对象是Servlet自己管理的,之所以出现上面的错误: 

          1.几乎都说与Output之类其他的输出流相互排斥了。 
          2.Struts方法之间调用引起的。 

     因为:每个方法都返回的是一个ActionForward对象,而response是ActionForward对象参数,所以就会使response冲突! 

   在实际的例子中,需要在最后返回null就可以的了。

   

0 0
原创粉丝点击