Bkjia.com Programming DocumentCause and solution of getOutputStream () has already been called for this response exception in jsp of tomcat5
In Tomcat 5, this error occurs in jsp. Generally, the output stream (such as the output image verification code and file download) is used in jsp, which is not properly handled.
The specific reason is that after jsp is compiled into a servlet in tomcat, the final part of the function _ jspService (HttpServletRequest request, HttpServletResponse response)
There is such a piece of code
Reference content is as follows:
Finally {
If (_ jspxFactory! = Null) _ jspxFactory. releasePageContext (_ jspx_page_context );
} |
The object used in jsp is released and response. getWriter () is called because this method conflicts with response. getOutputStream! Therefore, the above exception occurs. Then, of course, we need to propose a solution, which is actually quite simple (not as some friends say-delete all spaces and carriage return characters in jsp ), call the following two lines of code after the output stream is used:
Reference content is as follows:
Out. clear ();
Out = pageContext. pushBody (); |
- 2 pages in total:
- Previous Page
- 1
- 2
- Next Page