2 Replies Latest reply on Jul 28, 2010 2:59 PM by wangliyu

    jsf navigation help

    as6o
      I know this is more of a JSF question rather than a Seam 3 question but everybody here is so helpful and knowledgeable on JSF I figured I would ask it here...

      In Seam 2 I believe there was a way to intercept page navigation in such a way that you could always go to the login page if, say, identity.isLoggedIn() was false.  This would happen no matter which page you attempted to go to or where you navigated from.

      How do you do the same with JSF 2.0 faces-config.xml?  I want to always go to login.xhtml if identity.isLoggedIn() is false.  Any way to do this?

      I tried the following with no success (I also tried it without the <from-view-id> part):

      <navigation-rule>
         <from-view-id>*</from-view-id>
         <navigation-case>
            <if>#{!identity.isLoggedIn()}</if>
            <to-view-id>login.xhtml</to-view-id>
            <redirect />
         </navigation-case>
      </navigation-rule>

      Thanks!

      -Aaron
        • 1. Re: jsf navigation help
          wangliyu

          Same question here.

          • 2. Re: jsf navigation help
            wangliyu
            Here are my thoughts:

            1, the login.xhtml is satisfied wildcard *, you might want to put the secured resources/page into a folder and use "secure/*" rather than "*"

            2, the identity is sessionScoped, and default isLoggedIn() return false.

            see if this is helped.

            Thanks,
            Liyu