이 콘텐츠는 선택한 언어로 제공되지 않습니다.
4.3. Request Errors and Session Expiration Handling
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>
<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); }
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.