You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Craig R. McClanahan" <cr...@apache.org> on 2001/08/23 22:47:15 UTC

Re: Redirect page after catching exception


On Thu, 23 Aug 2001, Yuval wrote:

> Date: Thu, 23 Aug 2001 23:39:05 +0200
> From: Yuval <yu...@domainthenet.com>
> Reply-To: tomcat-user@jakarta.apache.org, yuval@domainthenet.com
> To: "Tomcat-User (E-mail)" <to...@jakarta.apache.org>
> Subject: Redirect page after catching exception
>
> Hi,
>
> can someone help we with how to stop the servlet after catching exception
> and redirect the page to error page?
>

It's not clear exactly what you mean.

If your servlet *catches* an exception, then the error page mechanism
provided by the container does not get involved at all.  You can use the
usual technique (RequestDispatcher.forward()) to forward control to an
error reporting page if you want.

The <error-page> declaration in web.xml is only invoked when your servlet
or JSP page *throws* an uncaught exception.

> Regards,
>
> Yuval

Craig


RE: Redirect page after catching exception

Posted by Yuval <yu...@domainthenet.com>.
Can you please explain to me how to use RequestDispatcher.forward()

Regards,

Yuval
Domain The Net Technologies Ltd.
6 Weitzman Blvd.
Ramat-Hasharon
Israel 47211
Tel: 972-3-5474443
Fax: 972-3-5474446
www.DomainTheNet.com

"This email message and any attachments hereto are intended only for use by
the addressee(s) named above, and may contain legally privileged and/or
confidential information. If you are not the intended addressee, you are
hereby kindly notified that any dissemination, distribution or copying of
this email and any attachments hereto is strictly prohibited. If you have
received this email in error, kindly delete it from your computer system,
and notify us at the telephone number or email address appearing above.
Thank you"



-----Original Message-----
From: craigmcc@mr1.bezeqint.net [mailto:craigmcc@mr1.bezeqint.net]On Behalf
Of Craig R. McClanahan
Sent: Thursday, August 23, 2001 22:47
To: Tomcat-User (E-mail); yuval@domainthenet.com
Subject: Re: Redirect page after catching exception




On Thu, 23 Aug 2001, Yuval wrote:

> Date: Thu, 23 Aug 2001 23:39:05 +0200
> From: Yuval <yu...@domainthenet.com>
> Reply-To: tomcat-user@jakarta.apache.org, yuval@domainthenet.com
> To: "Tomcat-User (E-mail)" <to...@jakarta.apache.org>
> Subject: Redirect page after catching exception
>
> Hi,
>
> can someone help we with how to stop the servlet after catching exception
> and redirect the page to error page?
>

It's not clear exactly what you mean.

If your servlet *catches* an exception, then the error page mechanism
provided by the container does not get involved at all.  You can use the
usual technique (RequestDispatcher.forward()) to forward control to an
error reporting page if you want.

The <error-page> declaration in web.xml is only invoked when your servlet
or JSP page *throws* an uncaught exception.

> Regards,
>
> Yuval

Craig