This content has been marked as final.
Show 2 replies
-
1. Re: Automatic login redirection to home
ryneezy.ryan.samiley.live.com Dec 28, 2010 7:55 PM (in response to mechtatel)Have you tried...
<page view-id="/login.xhtml" ...> <navigation evaluate="#{identity.loggedIn}"> <rule if-outcome="true"> <redirect view-id="/home.xhtml"/> </rule> </navigation> </page>
-
2. Re: Automatic login redirection to home
mechtatel Dec 29, 2010 3:24 PM (in response to mechtatel)Thank you for your reply Ryan,
Yes I tried your suggestion. Using
evaluate
not work with manually typing url direction, because then is not executed. Works well when is used action raised from s:link for example.That's worked for me.
login.page.xml
<action execute="#{authenticator.checkLoggedIn}" /> <navigation> <rule if-outcome="home"> <redirect view-id="/home.xhtml"/> </rule> </navigation> <navigation from-action="#{identity.login}"> <rule if="#{identity.loggedIn}"> <redirect view-id="/home.xhtml"/> </rule> </navigation>
authenticator
public String checkLoggedIn() { if(identity.isLoggedIn()) { return "home"; } else { return null; } }
Hope that this can be useful for somebody. If there is a better way, please let me know.