I've been with this problem for days, where I do the entire navigation structure between screens but it does not return anything and only a button that is the index is the only one that works for me, try to fix it by setting it to ajax="false" and at the beginning it worked for me but it happened to us that now it does not show me anything, they could help me I would appreciate it.
Here is the mangedbean code, the one in the navigation bar that you do not want to show and the Face Config.
ManagedBean code
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package cr.go.rnp.siansa;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
/**
*
* @author JulioColHdz
*/
@ManagedBean//(name = "buttonView")
@SessionScoped
public class ButtonView {
public String buttonExit() {
return "exit";
}
public void messageView(){
addMessage("Se agregó correctamente!!");
}
public String buttonAction() {
addMessage("Bienvenido a SIANSA!!");
return "success";
}
public String segmentoEstilos(){
return "segmento";
}
public String registroUsuarios(){
return "usuario";
}
public void addMessage(String summary) {
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, summary, null);
FacesContext.getCurrentInstance().addMessage(null, message);
}
}
Face Config Code
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>segmento</from-outcome>
<to-view-id>/TablaEstilos.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>Home.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>exit</from-outcome>
<to-view-id>index.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>usuario</from-outcome>
<to-view-id>RegistroUsuarios.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
bar code
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns="http://www.w3.org/1999/xhtml">
<!-- Barra de Navegacion -->
<h:form>
<p:menubar style="background: #333; color: #fff; width: 1185px; height: 30px;">
<p:menuitem>
<h:graphicImage value="/imgs/Slidenew1.png" style="margin-left: 10px; " width="50px" height="70px"></h:graphicImage>
</p:menuitem>
<p:submenu label="SIANSA" icon="ui-icon-person" style="width: 110px; color: #fff;">
<p:menuitem value="Perfil" url="#" icon="ui-icon-person" style="color: black;"></p:menuitem>
<p:menuitem value="Registro de Usuarios" action="#{buttonView.registroUsuarios}" icon="ui-icon-plusthick" style="color: black;" ajax="false"></p:menuitem>
<p:menuitem value="Salir" action="#{buttonView.buttonExit}" style="color: black;" icon="ui-icon-closethick" ajax="false"></p:menuitem>
</p:submenu>
<p:menuitem value="Segmento Estilos" action="#{buttonView.segmentoEstilos}" style="color: white;" ajax="false"></p:menuitem>
<p:menuitem value="Segmento Clases" style="color: white;"></p:menuitem>
<p:submenu label="Consultas" icon="ui-icon-help" style="width: 125px; color: #CCCCCC;">
<p:menuitem value="General" url="#" style="color: black;"></p:menuitem>
<p:menuitem value="Por Estilos" url="#" style="color: black;"></p:menuitem>
<p:menuitem value="Por Clases" url="#" style="color: black;"></p:menuitem>
</p:submenu>
<p:menuitem value="Home" action="#{buttonView.buttonAction}" icon="ui-icon-home" style="color: whitesmoke; float: right;" ajax="false" ></p:menuitem>
</p:menubar>
</h:form>
</ui:composition>