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

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

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

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

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

public ActionForward methodName()

--------》

public void methodName()

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

做个笔记,到时候试试。

你可能感兴趣的:(异常 getOutputStream() has already been called for this response)