-
1. Re: Global error handling in my JSf-richfaces application
nbelaevski Mar 17, 2009 8:53 PM (in response to rajeshiv)Hello,
I've tried this and it worked ok. So a couple of questions for you:
1. What is RF version used?
2. Does the problem reproduce for AJAX or common server requests? -
2. Re: Global error handling in my JSf-richfaces application
rajeshiv Mar 17, 2009 11:43 PM (in response to rajeshiv)Hi ,
To answer your first question : Iam using richfaces 3.0 version.
answer to the second question : Iam explicitly throwing a RuntimeException in my jsf application , to test that in the case of a runtime exception (unchecked exception) I should be redirected to the error page. I have included the code snippet below :throw new RuntimeException("Deliberately throwing the exception to test the global page" );
Iam throwing the above exception explicitly in one of my managed beans, and am expecting that this exception will force a redirection to the errpage.
My web.xml is as below :<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<servlet id="Servlet_1">
<servlet-name>InitializationServlet</servlet-name>
<servlet-class>com.equifax.aspire.infrastructure.kernel.web.InitializationServlet</servlet-class>
<init-param id="InitParam_1">
<param-name>initializationClasses</param-name>
<param-value>com.equifax.ic.core.kernel.impl.InterConnectSystemInitializer</param-value>
</init-param>
<init-param id="InitParam_2">
<param-name>requireCleanStart</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>6</load-on-startup>
</servlet>
<servlet-mapping id="ServletMapping_1">
<servlet-name>InitializationServlet</servlet-name>
<url-pattern>/initialization</url-pattern>
</servlet-mapping>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>global/index.jsp</welcome-file>
</welcome-file-list>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/global/errorpage.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/global/errorpage.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/global/errorpage.jsp</location>
</error-page>
As you can see I have my erro-page element defined after the rich faces filter and the coresponding mapping.
Does this order in the web.xml matter? was you mapping (web.xml) just like mine .
Iam using Sun RI of JSF in my application.
I hope this will help you to see what is that you did different than me.Looking forward to hear back from you. Thanks in advance -
3. Re: Global error handling in my JSf-richfaces application
ilya_shaikovsky Mar 18, 2009 6:04 AM (in response to rajeshiv)try to use latest versions at first. we can't support so old version like 3.0
if you within JSF 1.2 environment I highly recommend to use 3.3.0 GA. In this case we could check for your issues more easily and you will be able to get updates because any changes and fixes do not backported to old versions. -
4. Re: Global error handling in my JSf-richfaces application
vineyard Jun 16, 2011 7:13 PM (in response to ilya_shaikovsky)Hi Ilya,
If we have any error in backing beans (Managed Beans) or EJBs or jsps user is redirected to
errorpage
.jspBut the thing is we do not have the FacesContext object available there.
Is there is any way I can get reference to the FacesContent in the errorpage.jsp
our web.xml looks as below:
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/errorpage.jsp</location>
</error-page>
Thank you.