This is my menu:
<p:menubar>
<p:submenu label="Clientes">
<p:menuitem value="Cadastro" action="#{nomeBean.cadastrar} outcome="funcionario.xhtml" />
<p:menuitem value="Consulta" action="#{nomeBean.consultar}" outcome="funcionario.xhtml" />
</p:submenu>
</p:menubar>
...
<p:tabView dynamic="true" activeIndex="#{nomeBean.tabIndex}" >
<p:tab title="Cadastro">
</p:tab>
<p:tab title="Consulta">
tenho aqui uma dataTable
</p:tab>
</p:tabView>
This is my Bean:
private int tabIndex;
public void cadastrar() {
tabIndex = 0;
}
public void consultar() {
tabIndex = 1;
}
public int getTabIndex() {
return tabIndex;
}
So by clicking on the Query Menu, for example, it does not redirect to the query or registration tab.