Question

I have a JSP, which includes another JSP via <jsp:include>. I also have (what I think is) a standard error page setup. The problem is that when an exception occurs inside the included file, it doesn't "bubble up" to the including JSP. Instead, it inserts the error page mid-way through processing the included JSP.

Strangely enough, it doesn't even insert the error page's output at the line the error occurred. For instance, if I cause an exception at line 600 of the included JSP, I'll see output from the first 300-400 lines, then see the error page (in the outputted HTML).

Instead of the first 300-400 lines of the included file appearing in such a case, what I'd much rather see is none of the included page's output appears at all, and just the error page output. Is this possible, or is there some issue with the buffering of included files that prevents it?

Oh, and I've already tried setting "flush='true'" on the include tag, and I've tried wrapping everything in try/catches on both the includer and includee ... but none of that helped.

Was it helpful?

Solution

Does using a large buffer (<%@ page buffer="1024kb" %>) and flush="false" for the include work?

OTHER TIPS

The original "Bubble up" issue could be depend on the web container. We use Websphere 7 and it works a different way than other Websphere versions: the exceptions of the included page are not propagated back to the includer jsp. When no any error page defined for the included page, the exception's message is printed out to the output stream.

In case of websphere 7 we found the followng parameter which allow the exceptions to bubble up through the jsp:include tag: com.ibm.ws.webcontainer.dispatcherRethrowSError from fixpack 15. Here is additional information: http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Frweb_custom_props.html

In case of other web containers i have not experinced this problem yet.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top