We have a web application using struts2 with struts2-jquery-plugin, we need to capture 403 HTTP errors to redirect to the login page when an ajax request is requested. We put this code:
$(function () {
$.ajaxSetup({
error: function (x, status, error) {
if (x.status == 403) {
redirectToLogin();
} else {
manageAjaxError(status, error);
}
}
});
});
This is normal for all ajax requests, but does not work for jquery requests from struts2-jquery-plugin (for example: a call from the sj: submit button), the code above does not execute.
Found one onErrorTopics solution found for each tag, but it doesn’t work in the tabs (this may be an error).
Can I set a global processing error for queries from struts-jquery-plugin?
source
share