I have a JSP page with an error page specified. I call the page from a servlet via:
RequestDispatcher rd = ctx.getRequestDispatcher( jspPage );
rd.include( req, res );
How can I detect if the jsp page forwarded to the error page or not? I want to handle exceptions differently but no exception is thrown. And unfortunately I can't modify the JSP page itself or the error page.
Edit:
I'm thinking something like this might work after the include() line, any thoughts?
Object errorServletName = req.getAttribute( "javax.servlet.error.servlet_name" );
if ( errorServletName != null )
{ there was an error in the JSP... }