如何在JSF应用程序中实现注销过程

10

如何在JSF应用程序中实现注销过程

1个回答

18
public String logout() {
    ((HttpSession) FacesContext.getCurrentInstance().getExternalContext()
         .getSession()).invalidate();
     return "homePage";
}

<h:commandLink value="#{msg.logout}" action="#{logoutBean.logout}" />

谢谢你,Bozho。我的一个问题是,我的Faces会话映射对象,即FacesContext.getCurrentInstance().getExternalContext().getSessionMap()也会被作废吗? - rahul_d_m
@Bozho 当使用 j_security_check 进行用户登录时,是否有一种标准的方法来设置 msg.logout 变量? - simgineer
这个怎么样? FacesContext.getCurrentInstance().getExternalContext().invalidateSession() - Panu Haaramo

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接