Im having some problems with redirections. Im using primefaces and JSF 2.1. The thing is that JSF 2.1 doesn't have navigations rules and searching for an answer i found that I can put "faces-redirect=true". The problem is that that doesnt worked and i dont know why. The browser keeps telling me "No se puede encontrar el caso de navegación coincidente del ID de vista '/Autenticacion/login.xhtml' para la acción {1}' con el resultado '{2}'" Something like i dont have a navigation case for "/Autenticacion/login.xhtml" for the first action with the second result. With JSF 2.1 does not create a faces-config.xml file i create it and I added the rule for that action but the problem persists.
These are my files:
LOGIN BEAN
@ManagedBean(name="controlLogin")
@SessionScoped
public class ControladorLogin implements Serializable{
public String logIn(){
//actions
return "index" //algo tryed index.xhtml or index?faces-redirect=true
}
PRIMEFACES COMMANDBUTTON
<p:commandButton action="#{controlLogin.logIn}" value="Loguearse" ajax="false"/>
I also try with a commandLink
<p:commandLink action="#{controlLogin.logIn}" value="Loguearse" ajax="false"/>
FACES-CONFIG.XML //IF IS NOT NECESARY I CAN DELETE IT
<navigation-rule>
<from-view-id>/Autenticacion/login.xhtml</from-view-id>
<navigation-case>
<from-action>#{controlLogin.logIn}</from-action>
<from-outcome>index</from-outcome>
<to-view-id>/index.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
So if anyone can help me to do this redirection...thanks!!