Seam navigation ignored?
utdrew Sep 11, 2008 4:48 PMHi,
What I'm trying to do is redirect users to a password change page if they have been flagged in the database (temporary password, password expired, etc...). I've been trying to accomplish this via navigation rules in pages.xml and it seems like the navigation rules are simply ignored.
Because of the issue with RichFaces and login required I've put all of my 'secured' pages under the secure folder. Here is what I started with:
<page view-id="/secure/*" login-required="true"> <navigation> <rule if="#{loggedInEmployee.forcePasswordChange}"> <redirect view-id="/secure/employee/changePassword.xhtml" /> </rule> </navigation> </page>
When I login, I'm sent to the /secure/home.seam page but I would have expected it to send me to the changePassword page. I'm basing this assumption on the following from the booking demo:
<page view-id="/home.xhtml"> <navigation> <rule if="#{identity.loggedIn}"> <redirect view-id="/main.xhtml"/> </rule> </navigation> </page>
Based on this code I would assume that if you tried to hit /home.xhtml you would just be redirected to /main.xhtml. However, even on the seam demo site http://seam.demo.jboss.com/home.seam this does not work and seems to be the source of this issue.
I even tried modifying my login.page.xml with its own navigation rule:
<navigation> <rule if="#{loggedInEmployee.forcePasswordChange}"> <redirect view-id="/secure/employee/changePassword.xhtml" /> </rule> </navigation>
This did not work either. In fact, as I tested it, the only time I could get rules to fire was when I specified an action in a link i.e.
<s:link action="home" value="#{messages['home']}"/>
As opposed to
<s:link view="/secure/home.seam" value="#{messages['home']}"/>
If I click the link that has the action in it, I am redirected to the changePassword page but if I click the link with a view Id in it I'm not redirected. Also if I'm on the changePassword page and I manually enter a different URL in the browser no redirect occurs.
Can someone point out to me what I'm doing wrong? If there's a better way to do the redirect I'm all ears but it has to redirect from any other page after they've logged in.
Thanks,
Drew