Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6786113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:12:25+00:00 2026-05-26T17:12:25+00:00

I have this XML in my web.xml file: <error-page> <error-code>404</error-code> <location>/error/html/404</location> </error-page> If I

  • 0

I have this XML in my web.xml file:

<error-page>
    <error-code>404</error-code>
    <location>/error/html/404</location>
</error-page>

If I go to a page like /indexer (which doesn’t exist), then I get redirected properly to the URL /error/html/404. If I go to a page like /index/nope (which also doesn’t exist), then I a blank page and the URL reads /index/error/html/404. What can I put in the location tag to always get the correct URL, regardless of where I started?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:12:26+00:00Added an answer on May 26, 2026 at 5:12 pm

    This is not normal behaviour. It should definitely be relative to the context root. I cite from page 154 of the Servlet 3.0 specification:

    The subelement location element contains the location of the resource in the web
    application relative to the root of the web application. The value of the location
    must have a leading ‘/’.

    Your problem is caused by a bug in the servletcontainer used. Report it and/or upgrade to latest version. Or, perhaps you’ve a bad Filter intercepting on ERROR dispatcher for an URL pattern of /* which is using the RequestDispatcher#forward() wrongly.


    Update as per the comments, you’re using Tomcat 7.0.16, which is a Servlet 3.0 compatible container. Although your web.xml is declared conform Servlet 2.5 instead of 3.0, I can’t reproduce your problem with both web.xml versions on my local Tomcat 7.0.11, 7.0.19 nor 7.0.22. Also, the URL does not change here in browser address bar (and is not supposed to change). Just the original (wrong) URL remains in browser address bar. This makes me think that this is more likely caused by a bad filter or possibly a front controller servlet which is mapped on a too generic URL pattern of /* and is sending a redirect to the wrong URL. Check for such a filter or servlet in your webapp, debug and fix it accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a web.config file that looks like this: <?xml version=1.0?> <configuration> <system.web> <compilation
I have a page which uses a tag template. My web.xml is very basic.
In web.xml I have this <session-config> <session-timeout>2</session-timeout> </session-config> <listener> <listener-class>myapplication.SessionListener</listener-class> </listener> In the SessionListener.java
I have a third party web service that returns this xml <book> <release_date>0000-00-00</release_date> </book>
I have this xml file <?xml version=1.0 encoding=UTF-8?> <bo:C837ClaimParent xsi:type=bo:C837ClaimParent xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:bo=http://somelongpathHere/process/bo> <claimAux> ...
I have a C# web application which generates SVG code using RaphaelJS , which
I have this XML in a column in my table: <keywords> <keyword name=First Name
I have this XML : <?xml version=1.0 encoding=utf-8 ?> <IMPORT mode=FULL> .... </IMPORT> I'm
I have this XML: <?xml version=1.0 encoding=utf-8?> <ConfiguraCanale ID_Comando=1> <canaleDigitalOUTPUT ID_Canale=1 > <stato>0</stato> </canaleDigitalOUTPUT>
Lets assume we have this xml: <?xml version=1.0 encoding=UTF-8?> <tns:RegistryResponse status=urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure xmlns:tns=urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0 xmlns:rim=urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0> <tns:RegistryErrorList

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.