1 Reply Latest reply on Jun 11, 2009 4:14 PM by Nikos Paraskevopoulos

    navigation question

    giuseppe naddeo Newbie

      Hi everybody.


      I'm testing few basic navagation functions.


      what I did is:
      -created a new seam project

      -created a new dir test in web module

      -created in test dir 2 silly page: home1 and home2

      -created in test dir 2 page flow to check if user is logged as admin.


      as regard this last point I tried:

      1) in home1.page.xml


      <?xml version="1.0" encoding="UTF-8"?>
      <page [cut]>
              <navigation evaluate="#{identity.hasRole('admin')}">
                      <rule if-outcome="false">
                              <redirect view-id="/error.xhtml" />
                      </rule>
              </navigation>
      
      </page>



      and in home2.page.xml


      <?xml version="1.0" encoding="UTF-8"?>
      
      <page [cut]>
              <navigation>
                      <rule if="#{identity.hasRole('admin')}">
                              <redirect view-id="/error.xhtml" />
                      </rule>
              </navigation>
      
      </page>



      but nothing appends.


      so I tried:

      2) in pages.xml


      <?xml version="1.0" encoding="UTF-8"?>
      <pages [cut2]>
      
          <page view-id="*">
              <navigation>
                  <rule if-outcome="home">
                      <redirect view-id="/home.xhtml"/>
                  </rule>
              </navigation>
          </page>
      
          <page view-id="/home5.xhtml">
                      <navigation evaluate="#{identity.hasRole('admin')}">
                              <rule if-outcome="false">
                                      <redirect view-id="/error.xhtml" />
                              </rule>
                      </navigation>
          </page>
      
          <page view-id="/home6.xhtml">
                      <navigation>
                              <rule if="#{identity.hasRole('admin')}">
                                      <redirect view-id="/error.xhtml" />
                              </rule>
                      </navigation>
          </page>



      but nothing again.


      I'm sure is something missing in my code as I added few things to a project created by seam.
      but what is missing I cannot figure out witout a log/debug.
      any help?
      thank you very much!


      ps


      cut:  xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd"
              no-conversation-view-id="/noconv.xhtml"



      cut1: xmlns="http://jboss.com/products/seam/pages"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd"
             no-conversation-view-id="/home.xhtml"
             login-view-id="/login.xhtml"



      all as wizard wrote.


      my conf: jboss seam 2.1.1, jboss as 4.2.3.GA

        • 1. Re: navigation question
          Nikos Paraskevopoulos Novice

          Hello,


          I believe navigation rules are called after the JSF Invoke Application phase. The Invoke Application is not executed on GET requests for a JSF view (i.e. when you type the address on the browser address bar).


          You should see the desired effect, if you navigate to those pages from another JSF view, eg a page with:


          <h:form>
            <h:commandLink action="/homeX.xhtml" value="Home 1" />
          </h:form>