One of the way of logging out user is ::
public String logout() throws IOException {
ExternalContext ectx=FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse resp = (HttpServletResponse)ectx.getResponse();
HttpSession sess = (HttpSession)ectx.getSession(false);
sess.invalidate();
resp.sendRedirect("login.jspx");
return null;
}
public String logout() throws IOException {
ExternalContext ectx=FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse resp = (HttpServletResponse)ectx.getResponse();
HttpSession sess = (HttpSession)ectx.getSession(false);
sess.invalidate();
resp.sendRedirect("login.jspx");
return null;
}
No comments:
Post a Comment