i am working on a simple project in JSF 2.2 but i have some problem navigating between some pages. In the project i have a general template and all the views are template clients of that general template.
this is the view that i have troubles with:
<h:body>
<ui:composition template="./LayoutGeneral.xhtml">
<ui:define name="content">
<p:commandButton value="Registrar Comunidad" action="#{comunidadBean.irRegisterView}"/>
</ui:define>
</ui:composition>
</h:body>
In the action of the commandButton i call a method from the managed bean (Thar managed bean have other method that i call to change the page and they work fine, but this method doesnt):
(Managed Bean)
@ManagedBean
@SessionScoped
public class ComunidadBean {
private String idComunidad;
private String idPresidente;
private String calle;
private int numero;
private int nVecinos;
@EJB
private ComunidadDAO ejb;
public String register(){
if(ejb.realizaRegistro(this)){
return "principalView";
} else{
FacesMessage fm = new FacesMessage ("No se pudo registrar");
FacesContext.getCurrentInstance().addMessage("msg", fm);
return null;
}
}
public String irRegisterView(){
return "registroCView";
}
}
So the method "register" works fine and the page change but the method "irRegisterView" doesnt navigate to "registroCView" page.
Does someone has any idea of what it is happening?
Thanks!