JSF 2 Global exception handling, navigation to error page not happening

后端 未结 2 818
滥情空心
滥情空心 2020-11-30 07:00

I am developing a JSF 2.0 based web application. I am trying to implement a global exception handler which will redirect the user to a generic error page whenever any except

2条回答
  •  眼角桃花
    2020-11-30 07:52

    Unified way to handle both ajax and non ajax requests exception could be done simplifying your code. Instead of

    requestMap.put("exceptionMessage", t.getMessage());                 
    nav.performNavigation("/TestPRoject/error.xhtml");                 
    fc.renderResponse();
    

    is enough to use:

    fc.getExternalContext().redirect("/TestPRoject/error.xhtml");
    

提交回复
热议问题