Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using sendError with JSF

843842Jun 4 2004 — edited Jun 4 2004
I would like to display an error page when I run into some exception in a JSF page. I have configured web.xml as follows:

<error-page>
<error-code>100</error-code>
<location>/serverError.jsp</location>
</error-page>

Then, in my code, when I get an exception, I execute the following code:

FacesContext context = FacesContext.getCurrentInstance();
HttpServletResponse response =
(HttpServletResponse) context.getExternalContext().getResponse();

try {
response.sendError(100);
}
catch (IOException ex) {
log.error("Exception trying to handle server error: " +
"original exception = " + e);
}

However, when I execute this code, the server does not display my error page. I do see my error page on uncaught exception (I have also a error rule on error code 500). Is there anything special that should be done to make the error page handling in JSF?

Martin
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 2 2004
Added on Jun 4 2004
7 comments
489 views