异常 getOutputStream() has already been called for this response

来源:互联网 发布:买家被淘宝封号前预兆 编辑:程序博客网 时间:2024/06/05 15:22

在做文件下载时,jsp出现getOutputStream() has already been called for this response的异常

估计是在 Action class 中拿到 response.getOutputStream(), 并且将数据输出了,然而此 Action 又返回一个 ActionForward, 这样又有数据输出。

解决此问题可以用下面方法。

将 ActionForward 类型修改为 void,像下面这样:

public ActionForward methodName()

--------》

public void methodName()

这个问题是在处理文件下载问题时遇到。

做个笔记,到时候试试。

原创粉丝点击