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 7911805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:22:57+00:00 2026-06-03T13:22:57+00:00

I understand that it is possible to serve a custom Error 404 page using

  • 0

I understand that it is possible to serve a custom Error 404 page using configuration in web.xml like so:

<error-page>  
       <error-code>404</error-code>  
         <location>/NotFound.jsp</location>  
 </error-page>  

However I anticipate that many error-code webpages will be very similar – only the error code and text would change.

To cut down on excessive numbers of files and re-use, it would be nice to pass a parameter to a generic page which has all the usual HTML and CSS goodness.

I use Apache MyFaces, and have read about the ExceptionHandlerFactory (here) but I find that there is no provision for Error Codes.

Is it the case that the absolute only way I can customise error-code pages is to create one for each error-code that I want to customise, and wire them up using 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-06-03T13:22:59+00:00Added an answer on June 3, 2026 at 1:22 pm

    The error page can be just a JSF page. If you’re running a Servlet 3.0 capable container, you can have a global error page:

    <error-page>  
        <location>/error.jsf</location>  
    </error-page> 
    

    If you’re running a Servlet 2.5 container or older, or happen to use Tomcat 7 who still doesn’t have the global error page implemented as of now, then you need to specify separate error pages for every status code, but they can all point to the same error page.

    <error-page>  
        <status-code>404</status-code>
        <location>/error.jsf</location>  
    </error-page> 
    <error-page>  
        <status-code>500</status-code>
        <location>/error.jsf</location>  
    </error-page> 
    

    The status code and exception type are in EL available as follows:

    Status code: #{requestScope['javax.servlet.error.status_code']}
    Exception type: #{requestScope['javax.servlet.error.exception_type']}
    

    You can if necessary do conditional checks on this. Note that exceptions have by default always a status code of 500.

    If you’re using JSP’s successor Facelets, templating would even be more easy.

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

Sidebar

Related Questions

So, I understand that it's possible to set up in-app purchases for iPhone apps
I understand that it is not possible to tell what the user is doing
Is it possible to extract that info from the equivalence value? I understand that
I'm trying to understand if it's possible to create a set of variables that
I understand that Web Site Projects compile source on-the-fly, and Web Application Projects pre-compile
Possible Duplicate: Call php function from javascript I understand that php is server side
I have a custom user control that I am adding to a page via
I understand that it's possible (and I have done it) to return javascript and
I have three web application projects that share a common library of custom server
I understand that CoCreateInstance finds the COM server for the given class id, creates

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.