I have a menu where I have a Registry submenu and inside it a menuItem
Usuários
in my Template, and I also have a menuItem Sair
. The problem is that logging out only works on the Home
screen, which is the screen that is called after login. When I enter the registration screen and having exit the system is not redirected to main page.
<h:form style="display: inline-block" id="frmPrincipal">
<p:menubar styleClass="menu-sistema" id="menuBar">
<p:submenu label="Cadastros" rendered="#{usuarioBean.usuarioLogado.cargo == 'Administrador'}">
<p:menuitem value="Usuários" outcome="/usuario/cadastroUsuario" />
</p:submenu>
<p:menuitem value="Sair" action="{usuarioBean.sair}" update=":frmPrincipal:menuBar"/>
</p:menubar>
The exit method is as follows:
public String sair() {
usuarioLogado = null;
return "Login.xhtml?faces-redirect=true";
}