Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > catch url not found in Tomcat

Reply
Thread Tools

catch url not found in Tomcat

 
 
mail2bill@gmail.com
Guest
Posts: n/a
 
      11-08-2005
Hi all,

Is there a way to catch the Page Not Found exception in Tomcat when
user did not typed in the correct page name?

I am trying to catch it and then redirect the user to my home page.
Thank you.

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Asbj=F8rn?= L. Johansen
Guest
Posts: n/a
 
      11-08-2005
On tir, 2005-11-08 at 11:05 -0800, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi all,
>
> Is there a way to catch the Page Not Found exception in Tomcat when
> user did not typed in the correct page name?


Put this in your web.xml:

<error-page>
<error-code>404</error-code>
<location>/WEB-INF/404.jsp</location>
</error-page>

> I am trying to catch it and then redirect the user to my home page.


Replace /WEB-INF/404.jsp with whatever location you want to redirect to.
--
Asbjørn L. Johansen

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
catch doesn't catch a thrown exception Marteno Rodia Java 5 08-05-2009 03:30 AM
catch(...) doesn't catch everything Adam C++ 9 02-02-2006 05:02 PM
why catch (...) can not catch such exception John Black C++ 8 08-20-2004 02:34 PM
URL - substitution of a correct URL by a GUID like URL in favorites. Just D. ASP .Net Mobile 0 08-11-2004 04:26 PM
redirect URL's, return URL's, and URL Parameters Jon paugh ASP .Net 1 07-10-2004 05:29 AM



Advertisments