JSF PostConstruct Exception Handling - Redirect

前端 未结 1 431
离开以前
离开以前 2021-01-14 16:46

I\'d like to handle a JSF @PostConstruct exception by redirecting to another page. I\'m using FacesContext.getCurrentInstance().getExternalContext().dispatch(\"page.j

1条回答
  •  孤独总比滥情好
    2021-01-14 17:20

    Look at this similar question: JSF navigation redirect to previous page

    According to BalusC you can use the following instead of dispatch:

    FacesContext.getCurrentInstance().getExternalContext().redirect(url);
    

    Or, in order to stop rendering the current page, put

    FacesContext.getCurrentInstance().responseComplete();
    

    Regards

    0 讨论(0)
提交回复
热议问题