Good evening
I have the following problem, I have a JSF application and I need to make a logoff command, I did several and all gave the same result, it "kills" the user session (logs), but does not redirect to login screen (which is screen I want it to come back) good here are the codes:
This is ManageBean:
public String logoff() {
FacesContext fc = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession)fc.getExternalContext().getSession(false);
session.invalidate();
return "/pages/public/index.xhtml";
}
And here is the XHTML commandLink:
<p:commandLink id="logoff" value="Teste"
actionListener="#{autenticacaoManageBean.logoff}" ajax="false" />
The login screen and the screen that the logoff button is in separate folders
login is in pages/public/login.xhtml
the button is in pages/templates/header.xhtml
Thanks in advance for the help.