I would like for my app to redirect users encountering a JSF ajax error to a custom error page.
Here is what I have undertaken and where I met some issues:
var onError = function onError() {
window.location = 'http://'+jQuery(location).attr('host')+'WEB-INF/include/error-pages/'+'ajaxError.html';//does not work of course!
};
jsf.ajax.addOnError(onError);
Can anyone please provide advice on how to redirect to a page located within the WEB-INF folder?
Regards,
You can’t. The
/WEB-INFfolder is not publicitly available. The Servlet API specification forbids that as it’s usually the folder to hold configuration files and template files which cannot be presented standalone. Put it somewhere outside/WEB-INF(and/META-INF) in public webcontent or create a public template which includes that error page.Is it really an include page as its path suggests? Isn’t it actually a full page as you’re seem to be trying to show them in its full glory? That file should then definitely be placed outside
/WEB-INF.