catch url not found in Tomcat

Discussion in 'Java' started by mail2bill@gmail.com, Nov 8, 2005.

  1. Guest

    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.
    , Nov 8, 2005
    #1
    1. Advertising

  2. On tir, 2005-11-08 at 11:05 -0800, 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
    =?ISO-8859-1?Q?Asbj=F8rn?= L. Johansen, Nov 8, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William Parker
    Replies:
    1
    Views:
    3,075
    Martin
    Jun 27, 2004
  2. John Black
    Replies:
    8
    Views:
    4,141
    Xenos
    Aug 20, 2004
  3. Replies:
    3
    Views:
    533
  4. Adam
    Replies:
    9
    Views:
    554
    red floyd
    Feb 2, 2006
  5. Marteno Rodia

    catch doesn't catch a thrown exception

    Marteno Rodia, Aug 3, 2009, in forum: Java
    Replies:
    5
    Views:
    549
    Daniel Pitts
    Aug 5, 2009
Loading...

Share This Page