1
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 tab or register.
I don’t know what happens, but it should work...:/ It looks like the action doesn’t work, don’t arrow the tabIndex.
– user3096136
Try printing a text in one of the methods (register or query) to see if it displays. Note: If you have a Javascript error it doesn’t even go to the next phase of JSF. Try opening the browser’s javascript console and see what happens.
– Cold
Hy Cold, Thanks for the help.. He is already entering the method and setting the values. But since scopo is of the View type when redirecting it loses all data.
– user3096136
Then change his scope, because that way everything is working right (being @Viewscoped)
– Cold
It’s changed to Sesssion consumed a lot of memory because I have a table too.. rsrs And I ended up finding a Flahsscoped that saves the Object or value that Voce wants in memory. Inside the method vc makes the change. 

public String redirecionarComFlash() {

FacesContext instance = FacesContext.getCurrentInstance();

ExternalContext externalContext = instance.getExternalContext();
externalContext.getFlash(). put("key", value); externalContext.getFlash(). setKeepMessages(true); Return URL + "? faces-redirect=true"; }
– user3096136
If this works I will post here.. Again Thank you for making logic available!
– user3096136