File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Handling Exception/Runtime Exception in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Handling Exception/Runtime Exception in JSF " Watch "Handling Exception/Runtime Exception in JSF " New topic

Handling Exception/Runtime Exception in JSF

sheetal sheetal

Joined: Feb 15, 2007
Posts: 1

Any good pointers to documents describing proper error handling.

Not just navigation rules to an error.jsp file but also handling of runtime exceptions and exceptions in backing beans where you cannot use navigation rules (calling a method from JSF EL etc.).

I am developing jsr 168 portlets using jsf on websphere portal.

I can't get the error handling via web.xml to function and other places I can't manually make it go to an error.jsp in case of exceptions.
How to handle the runtime exception in JSF.

1. By including following tags in web.xml

its not working.

2. If include the
<%@page errorPage="../error/GenericError.jsp" %>
in jsp page then
it is not forwading to error page giving asaertion failure exception

If we change the GenericError.jsp tag like


then it is going to error page but the
action inside the error page is not getting called its backing bean

Here is code of error.jsp

<%-- jsf:pagecode language="java" location="/JavaSource/pagecode/JSPs/" --%><%-- /jsf:pagecode --%>
<%@taglib uri="" prefix="f"%>
<%@taglib uri="" prefix="portlet"%>
<%@taglib uri="" prefix="h"%>
<%@ page isErrorPage="true" %>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<div class="errorMessage"><%= exception.getLocalizedMessage() %></div>
<f:subview id="name">
<h:commandButton action="#{OSPMTASecurityBean.cancel}" value="submit"/>

Manuel Palacio
Ranch Hand

Joined: Oct 16, 2000
Posts: 45
I am also developing portlets. Check this entry for some alternatives:

<a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: Handling Exception/Runtime Exception in JSF
jQuery in Action, 3rd edition