GetOutputStream (already) has been called for this response error resolution

Recommended for you: Get network issues from WhatsUp Gold. Not end users.
To solve the problem.
1, In our application verification code, will use the byte stream (response.getOutputStream) to the verification code output, but the JSP page will end up calling the character stream JspWriter out () method to the content of the page output. By viewing the servlet API we can see that, in the servlet is not able to use the two current output, the solution will validate code written in servlet, see below.
2, That request forwarding (request.getRequestDispacher) (.Forward) () and request (response.sendRedirect ()) difference we all know. The request.getRequestDispacher (.Forward)) (the same request object and the response object sharing between caller and callee, they belong to the same access request and response process. JSPPage translation for_servletWill finally callreleasePageContext()Method( All PageContext objects obtained via this method shall be released by invoking releasePageContext().)The release of our page all entity objects, When we have the page output when the caller, Will throw this exception. The specific reasons are not clear, you heroes who know can tell you. In fact, the verification code is the same principle, If we will validate code written in JSP page, Because the JSP page will call JspWriter out () method will output, Also our pictures and call response.getOutputStream () method will throw this exception; if we will validate code written in Servlet, Do not use two output will not go wrong. If we really want to use response.getOutputStream in JSP (), such as verification code, jspSmartUpload, we need in the end (code of JSP page and add the following code):
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Pearl at May 01, 2014 - 6:55 AM