JSF中用户登出返回登录页面问题

JSF中用户登出返回登录页面问题

在页面中使用

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

做登出操作的时候,代码如下:

public String logoutHMS() {

String outCome ="logoutSuccess";

System.out.print("Logout!!);

// 设置登录Session关键信息

FacesContext fc = FacesContext.getCurrentInstance();

HttpSession Session = (HttpSession) fc.getExternalContext()

.getSession(false);

Session.invalidate();

return outCome;

}

不能使用actionListener属性,否则退出了,重载不了登录页面。

评论

暂无评论