天天看點

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屬性的内容