I'm working on a little webtool for practice and navigation rules have been brought to my attention. So i looked at a couple of web tutorials and tried it myself and it's not working for me. It won't redirect to the desired page.
faces-config.xml (only the part that should matter)
<navigation-rule>
<from-view-id>/kursleiter.xhtml</from-view-id>
<navigation-case>
<from-action>#{verifyCredentials.save}</from-action>
<from-outcome>ok</from-outcome>
<to-view-id>/teilnehmer.xhtml?faces-redirect=true</to-view-id>
</navigation-case>
</navigation-rule>
The class that returns the value for <from-outcome>
public class verifyCredentials() {
public String save(Klasse klasse, Module modul) {
//do some other stuff
return "ok";
}
}
When this commandLink ist pressed, the redirect should happen
<p:commandLink actionListener="#{verifyCredentials.save(klasse, modul)}">#{modul.modulnummer} </p:commandLink>
Now, this brings a couple of questions to me:
- Would i need to add
/faces/
in the<from-view-id>
? - Couldn't i just simply return the link to the desired page in my class?
- Did i make any logical mistakes that i'm too blind to see?
Thank you in advance - Reteras