tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zsolt Horvath" <horzs...@mail.tiszanet.hu>
Subject Re: Servlets and JSP Error Pages
Date Mon, 01 Oct 2001 14:09:42 GMT
I think it's easier:
Put this line every JSP:

1. <%@ page errorPage="errorHandler.jsp"%>
2. Create an errorhandler JSP. (Example is attached.)

Every throwable error will redirect to errorhandler.jsp.

bye: horZsolt

----- Original Message -----
From: "Arnaud Héritier" <aheritier@sopra.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Monday, October 01, 2001 3:45 PM
Subject: RE: Servlets and JSP Error Pages


It's not a really clean solution but you can do it like this :

try{
.....
}catch(Exception e){
    RequestDispatcher rd =
getServletContext().getRequestDispatcher("MyErrorPage.jsp");
    request.setAttribute("javax.servlet.jsp.jspException", e);
    rd.forward(request, response);
}

I tested it and it works.

arno

> -----Message d'origine-----
> De: Brendan McKenna [SMTP:mckennab@taringold.ie]
> Date: lundi 1 octobre 2001 15:35
> À: tomcat-user@jakarta.apache.org
> Objet: Servlets and JSP Error Pages
>
> Hi,
>
> Is there a way to route exceptions thrown in servlets to a JSP
> error page?
>
>
> Brendan
> --
> Brendan McKenna        Email: brendan.mckenna@taringold.ie
> Development Strategist        Phone: +353-61-338177
> Taringold Ltd.        Fax:   +353-61-338065
>



Mime
View raw message