您的位置:首页技术文章
文章详情页

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

【字号: 日期:2024-05-31 17:45:33浏览:76作者:猪猪

在页面中使用

<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属性,否则退出了,重载不了登录页面。

标签: JavaScript
相关文章: