aspose file tools*
The moose likes Servlets and the fly likes Handling Exceptions in JSPs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Handling Exceptions in JSPs" Watch "Handling Exceptions in JSPs" New topic
Author

Handling Exceptions in JSPs

Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
I'm investigating how to impliment error handling in some JSP's we're writing and I just wanted to check something.
Would I be correct in thinking that if a JSP in included in another JSP, and the included JSP throws a runtime exception that exception will be passed up to the JSP that included it?
if this is the case and the exception is handled properly in the calling JSP would an error still be sent to the browser??


Pounding at a thick stone wall won't move it, sometimes, you need to step back to see the way around.
Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
OK now I have established that the error is passed up to the including JSP ... now I have a problem.
I have a template jsp which includes a number of other jsps to create a page.
Now what I want is for any errors thrown in the included jsps to be forwarded onto an error.jsp using the errorPage attribute of the page directive and have that error.jsp handle the error.
I thought this would be simple enough, and it does work BUT the logs are telling me the exception is still being passed up to the template! Does anyone know a way of preventing this??
vikinsa
Ranch Hand

Joined: Apr 18, 2001
Posts: 46
Yes! the exception thrown by the included jsp will be handed over to the uncluding jsp.

Originally posted by Angela Poynton:
I'm investigating how to impliment error handling in some JSP's we're writing and I just wanted to check something.
Would I be correct in thinking that if a JSP in included in another JSP, and the included JSP throws a runtime exception that exception will be passed up to the JSP that included it?
if this is the case and the exception is handled properly in the calling JSP would an error still be sent to the browser??


------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com


Vikas Aggarwal<BR>Technology Associate<BR>http://www.vikinsa.com
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Handling Exceptions in JSPs