Search

4.3. Request Errors and Session Expiration Handling

download PDF
RichFaces lets you redefine the standard handlers responsible for processing exceptions. We recommend defining your own JavaScript, which will be executed when exceptional situations occur.
Add the following code to web.xml:
<context-param>
	<param-name>org.ajax4jsf.handleViewExpiredOnClient</param-name>
	<param-value>true</param-value>
</context-param>

4.3.1. Request Errors Handling

To execute your own code on the client in the event of an error during an AJAX request, you must redefine the standard A4J.AJAX.onError method like so:
 A4J.AJAX.onError = function(req, status, message){
    window.alert("Custom onError handler "+message);
}
This function accepts the following as parameters:
req
a parameter string of a request that calls an error
status
the number of an error returned by the server
message
a default message for the given error
Therefore, you can create your own handler that is called when timeouts, internal server errors, etc. occur.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.