I've a strange problem with the JSP's error page, i'll expose it.
My error page (located in Eclipse Workspace in "/project/WebContent/resources/error.jsp") is very simple, like this:
So, in the pages in which there may be exceptions (example xxx.jsp in "/project/WebContent/xxx.jsp") i declare something like this:
Well, the problem is that when an exception occurs, it is correctly captured by jsp (in Console appears the log with the exception's message printed from the error.jsp), but the error.jsp page is not rendered in the Browser... exactly, in the Browser appears the page in which the exception occurs (xxx.jsp), but loaded for half, like if when the exception occurs, the browser go to crash and isn't redirected to error.jsp
I've also tried to render the error.jsp calling directly it's url from the browser and is correctly rendered, then the error.jsp hasn't structure problems.
So, where do you think could be the problem?
Seeing half your your generated page rather than the error message sounds like the page has started sending itself to the browser before the error has occurred.
How big a jsp page are we talking about?
What server are you using?
Basically, JSP pages have a buffer (default size is 8k) which they generate into. It starts sending that back to the client when the page is complete, or the buffer fills up (whichever occurs first)
If an error occurs BEFORE the response is sent back, the server can cancel sending, and instead send your error page.
Once the response starts sending though, thats it, you're committed, and you can't change it.
That sounds like it might be happening here.
One thing you can try doing is increasing the buffer on this page:
However as Bear has already mentioned, this is less used nowadays. Most of the logic that generate errors/exceptions should be in java code in a servlet rather than a JSP.
If you live in a cold climate and on the grid, incandescent light can use less energy than LED. Tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library