JSF navigation redirect to previous page

前端 未结 7 1586
一向
一向 2020-12-09 07:06

Once the user successful login to the system, the system will redirect the user to the homepage. Now my problem is, if the user clicks on the view account page without login

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-09 07:08

    Not sure, but try doing this through ExternalContext facilities:

    Something like this:

    ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
    externalContext.redirect(externalContext.encodeResourceURL(externalContext.getRequestContextPath()+getUrl()));
    

提交回复
热议问题