After user logged in , he will do the logout for the current process
Home page xhtml is
<h:commandLink value="#{menu.getName()}" action="#{loginBean.logout}" ></h:commandLink>
Bean class is
public String logout()
{
FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
return "Login?redirect=true";
}
- Actually what will happen in logout process is clean the current session
- So the user cannot access any page
- We can invalidate the session by following method in JSF
Home page xhtml is
<h:commandLink value="#{menu.getName()}" action="#{loginBean.logout}" ></h:commandLink>
- When we click the commandLink the below method will be invoked
Bean class is
public String logout()
{
FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
return "Login?redirect=true";
}
Comments
Post a Comment