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

  • Home
  • SEARCH
  • 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 6319093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:44:39+00:00 2026-05-24T15:44:39+00:00

I am using <error-page> element in web.xml to specify the friendly error page when

  • 0

I am using <error-page> element in web.xml to specify the friendly error page when user encounters a certain error such as error with code of 404:

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

However, I want that if the user does not meet any error code specified in <error-page>, he or she should see a default error page. How can I do that using the element in the web.xml?

  • 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-24T15:44:40+00:00Added an answer on May 24, 2026 at 3:44 pm

    On Servlet 3.0 or newer you could just specify

    <web-app ...>
        <error-page>
            <location>/general-error.html</location>
        </error-page>
    </web-app>
    

    But as you’re still on Servlet 2.5, there’s no other way than specifying every common HTTP error individually. You need to figure which HTTP errors the enduser could possibly face. On a barebones webapp with for example the usage of HTTP authentication, having a disabled directory listing, using custom servlets and code which can possibly throw unhandled exceptions or does not have all methods implemented, then you’d like to set it for HTTP errors 401, 403, 500 and 503 respectively.

    <error-page>
        <!-- Missing login -->
        <error-code>401</error-code>
        <location>/general-error.html</location>
    </error-page>
    <error-page>
        <!-- Forbidden directory listing -->
        <error-code>403</error-code>
        <location>/general-error.html</location>
    </error-page>
    <error-page>
        <!-- Missing resource -->
        <error-code>404</error-code>
        <location>/Error404.html</location>
    </error-page>
    <error-page>
        <!-- Uncaught exception -->
        <error-code>500</error-code>
        <location>/general-error.html</location>
    </error-page>
    <error-page>
        <!-- Unsupported servlet method -->
        <error-code>503</error-code>
        <location>/general-error.html</location>
    </error-page>
    

    That should cover the most common ones.

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

Sidebar

Related Questions

I was just writing some quick code and noticed this complier error Using the
Using YUICompressor I get the following error from my javascript code: [ERROR] 270:201:missing name
I'm testing a web page using selenium. I want to get all the 'leaf
I'm trying to test web service calls using an ASP.NET page that creates a
I'm using HPricot's css search to identify a table within a web page. Here's
Using MSHTML I'd like to set the user focus on a text element, what
I'm using the Selenium 2.0 web drivers to try and login to a page.
Has anyone encountered this error using SQL Server 2005 and Data access application blocks
I'm getting the invalid lvalue error using gcc 3.4.6. The line that invokes the
I have got this error when using Enterprise Library 3.1 May 2007 version. We

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.