Hi,
I have had to fix a problem with an old page, that has been throwing this exception even though it still works fine. The page does make a call to
ServletOutputStream output = response.getOutputStream();
so that it can stream a pdf to the browser, and it also uses lots of scriplets and methods declared within a jsp....
I have read most of the posts on this, and other sites relating to this issue. I dont want someone to tell me what to do, maybe just explain a little about why it happens.
I have read through some of the jsp api's, and have also been reading through the generated code of the servlet class for the jsp that is causing the problem. I understand that the outputstream can only be called once to get the jspwriter object 'out', I am just having a little trouble understanding why the following lines of code fixed this issue:
out.clear();
out = pageContext.pushBody();
The page now works ok and the exception is never raised, but I dont want to say this issue is resolved until I know why the above lines of code fixed my problem. In the generated java file I see the lines:
out = pageContext.getOut();
_jspx_out = out;
So I am guessing getOut() must make a call to get an outputstream, which can only occur once.. So if anyone can help me understand what pushBody is doing that makes it ok to now obtain a new ServletOutputStream from the response object I would be grateful.
Thanks