你可以使用session的 invalidate方法 .
下面是一個從action方法中結束session的例子: :

public String logout()
{

FacesContext fc = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) fc.getExternalContext().getSession(false);
session.invalidate();
return "login_page";
}

下面的代碼片段示例了如何在JSP頁面中結束session:
<% session.invalidate(); %>
<c:redirect url="loginPage.jsf" />
posted on 2008-11-29 13:06
Vincent-chen 閱讀(439)
評論(0) 編輯 收藏 所屬分類:
JSF