天天看点

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

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

解决方法如下:

将JSP页面的最后两行代码的注释去掉,这两行代码的作用如下:

out.clear():清空缓存的内容。

pageContext.pushBody():参考API

public BodyContent pushBody()

Return a new BodyContent object, save the current "out" JspWriter, and update the value of the "out" attribute in the page scope attribute namespace of the PageContext.
Returns:
the new BodyContent

·返回一个新的BodyContent(代表一个HTML页面的BODY部分内容)

·保存JspWriter实例的对象out

·更新PageContext的out属性的内容