Servlets and JSP Error Pages

2001-10-01 Thread Brendan McKenna

Hi,

Is there a way to route exceptions thrown in servlets to a JSP 
error page?


Brendan
-- 
Brendan McKennaEmail: [EMAIL PROTECTED]
Development Strategist Phone: +353-61-338177
Taringold Ltd. Fax:   +353-61-338065





Re: Servlets and JSP Error Pages

2001-10-01 Thread Zsolt Horvath

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 [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
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:[EMAIL PROTECTED]]
 Date: lundi 1 octobre 2001 15:35
 À: [EMAIL PROTECTED]
 Objet: Servlets and JSP Error Pages

 Hi,

 Is there a way to route exceptions thrown in servlets to a JSP
 error page?


 Brendan
 --
 Brendan McKennaEmail: [EMAIL PROTECTED]
 Development StrategistPhone: +353-61-338177
 Taringold Ltd.Fax:   +353-61-338065




 errorHandler.jsp