2
I have a menu where I have a submenu Register and inside it a menuItem
Usuários
in my template, and also have a menuItem Sair
. The problem is that the exit only works on the screen Home
, 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";
}
It didn’t work, and also if I put this in my method it returns an error string.
– DiegoAugusto
In your <p:menuitem> put ajax = "false".
– Rafael
all right, I’ll try
– DiegoAugusto
It hasn’t worked yet, the
usuarioLogado
receives null but the page is not redirected– DiegoAugusto
Exit only works normally on the Home page
– DiegoAugusto
Anyway, I used one of the options that are in the link Voce sent me and it worked. Thanks
– DiegoAugusto