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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:42:51+00:00 2026-05-30T13:42:51+00:00

I have a Facelets(JSF 1.2 (myfaces)) web app and I want to customize my

  • 0

I have a Facelets(JSF 1.2 (myfaces)) web app and I want to customize my error page – which would seem to be a natural thing to do when an application matures.
I got really confused in the process.

I found the following:

  • I haven’t found a way to customize Facelets’ error page. I haven’t found where the template is. I have found solutions with overriding the ViewHandler that would do sendRedirect(). I think this should be accomplishable without writing code, especially the ViewHandler.

  • I have found a way to switch off Facelets’ error handling and using myFaces’ one:

code:

<context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
    <param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
    <param-value>true</param-value>
</context-param>
<context-param>
    <param-name>org.apache.myfaces.ERROR_TEMPLATE_RESOURCE</param-name>
    <param-value>/pages/public/errorPage.jsf</param-value>
</context-param>

Unfortunately I cannot seem to make myFaces find a JSF page. I need to use a jsf page because I want to use the site’s layout which is fragmented over a few templates.
Source: http://wiki.apache.org/myfaces/Handling_Server_Errors

  • I tried a tomahawk solution:

web.xml:

<context-param>
    <param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
    <param-value>true</param-value>
</context-param>

<context-param>
    <param-name>org.apache.myfaces.ERROR_HANDLER</param-name>
    <param-value>org.apache.myfaces.tomahawk.util.ErrorRedirectJSFPageHandler</param-value>
</context-param>

faces-config.xml:

<navigation-rule>
    <from-view-id>*</from-view-id>
    <navigation-case>
        <from-outcome>java.lang.Throwable</from-outcome>
        <to-view-id>/pages/public/errorPage.xhtml</to-view-id>
    </navigation-case>
</navigation-rule>

Source: http://wiki.apache.org/myfaces/Handling_Server_Errors

  • I found that I can use the container’s error-handling via <error-page> in web.xml. I successfully forwarded to a jsf error page. Here the problem is that I cannot display the Exception – I don’t know how.

Update: I found out how – with a ManagedBean:

public class ErrorDisplayBean {
    public String getStackTrace() {
        FacesContext context = FacesContext.getCurrentInstance();
        Map requestMap = context.getExternalContext().getRequestMap();
        Throwable ex = (Throwable) requestMap.get("javax.servlet.error.exception");
        ...
    }
}

see http://wiki.apache.org/myfaces/Handling_Server_Errors for the rest of the code.

What I want to accomplish: I want to use Facelets’ error-handling mechanism without writing code and be able to display the Exception on a jsf page. If that is not possible, I’d like to use myFaces’ error-handling again with displayin the Exception. I think one of them should be possible.

  • 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-30T13:42:52+00:00Added an answer on May 30, 2026 at 1:42 pm

    I think you can still make of configuration through your web.xml:

     <error-page>
        <exception-type>java.lang.Throwable</exception-type>
        <location>/error.xhtml</location>
     </error-page>
    

    Which can be used for error codes too..

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

Sidebar

Related Questions

In my .xhtml page, I have the following form: <ui:composition xmlns:ui=http://java.sun.com/jsf/facelets template=./../template/CustomerTemplate.xhtml xmlns:h=http://java.sun.com/jsf/html xmlns:f=http://java.sun.com/jsf/core
I'm trying to import this page to my JSF page which is gonna have
I have a JSF application in which I have different servlets and facelets. The
I have a JSF page which has a variable number inputText elements containing numeric
i have a simple problem here i am making a simple jsf web app
I'm using JSF 1.2 with Richfaces and Facelets. I have an application with many
Using Richfaces 3.3.0GA, jsf 1.2_14 and facelets. I have a richfaces ModalPanel with an
I have a Java based web-application using Java Server Faces and Facelets. I am
I have a Java EE App that has JSF2 + PrettyFaces + Facelets +
I have been investigating a JSF upgrade on our existing web apps that are

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.