你可以使用session的 invalidate方法 . 
下面是一个从action方法中结束session的例子: :
 

 public String logout()
public String logout()  {
{

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

 
 
下面的代码片段示例了如何在JSP页面中结束session: 
<% session.invalidate(); %>
<c:redirect url="loginPage.jsf" /> 
	posted on 2008-11-29 13:06 
Vincent-chen 阅读(454) 
评论(0)  编辑  收藏  所属分类: 
JSF