6 Replies Latest reply on Jan 19, 2007 2:00 PM by adsf adsf

    Global navigation rules in pages.xml

    Pete Muir Master

      Is there currently a way to use a global navigation rule e.g.

      <navigation-rule>
       <navigation-case>
       <from-outcome>foo</from-outcome>
       <to-view-id>/foo.xhtml</to-view-id>
       </navigation-case>
      </navigation-rule>


      in pages.xml?

      They are occasionally useful, and without them, some navigation will still have to go in faces-config.xml

        • 1. Re: Global navigation rules in pages.xml
          Norman Richards Master

          Does view-id="*" work for you?

          <page view-id="*">
           ...
          </page>
          


          • 2. Re: Global navigation rules in pages.xml
            Pete Muir Master

            Yes. Thanks :)

            I also noticed that

            <h:commandLink action="foo">Foo</h:commandLink>


            doesn't work if you have the navigation rule in pages.xml (as expected I suppose) whilst of course

            <s:link action="foo">Foo</s:link>


            works.

            • 3. Re: Global navigation rules in pages.xml
              Norman Richards Master

              Oh.. Hmm... I might be missing something obvious, but I don't see why that shouldn't work. It sounds like a bug.

              • 4. Re: Global navigation rules in pages.xml
                Pete Muir Master

                Yeah, you're right, it should work. I was getting confused.

                http://jira.jboss.org/jira/browse/JBSEAM-674

                • 5. Re: Global navigation rules in pages.xml
                  Gavin King Master

                  Did the following not work:


                  <page view-id="...">
                  
                   <navigation>
                   <rule for-outcome="foo">
                   <render view-id="/foo.xhtml"/>
                   </rule>
                   </navigation>
                  
                  </page>


                  • 6. Re: Global navigation rules in pages.xml
                    adsf adsf Newbie

                    Is this also supposed to work when I refer to "global navigation rules" from pageflow .jpdl.xml files?

                    I.e. I have in a jpdl.xml file:

                    <page name="home" view-id="home" redirect="true">
                     <end-conversation/>
                    </page>

                    And in my pages.xml file:
                    <page view-id="*">
                     <navigation>
                     <rule for-outcome="home">
                     <render view-id="/home.xhtml" />
                     </rule>
                     </navigation>
                    </page>

                    But when i come to the "home" state if my pageflow I get:
                    javax.servlet.ServletException: ViewId must start with '/' (viewId = home)
                     org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:61)
                     org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
                     org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
                     org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                    
                    root cause
                    
                    javax.servlet.ServletException: ViewId must start with '/' (viewId = home)
                     javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
                     org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                     org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                     org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
                     org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
                     org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                    
                    root cause
                    
                    java.lang.IllegalArgumentException: ViewId must start with '/' (viewId = home)
                     org.apache.myfaces.application.jsp.JspViewHandlerImpl.getViewIdPath(JspViewHandlerImpl.java:286)
                     org.apache.myfaces.application.jsp.JspViewHandlerImpl.getActionURL(JspViewHandlerImpl.java:158)
                     org.jboss.seam.jsf.SeamViewHandler.getActionURL(SeamViewHandler.java:48)
                     com.sun.facelets.FaceletViewHandler.getActionURL(FaceletViewHandler.java:786)
                     org.ajax4jsf.framework.ViewHandlerWrapper.getActionURL(ViewHandlerWrapper.java:85)
                     org.jboss.seam.core.Manager.redirect(Manager.java:932)
                     org.jboss.seam.core.Manager.redirect(Manager.java:859)
                     org.jboss.seam.core.Pageflow.redirect(Pageflow.java:221)
                     org.jboss.seam.core.Pageflow.navigate(Pageflow.java:209)
                     org.jboss.seam.core.Pageflow.navigate(Pageflow.java:299)
                     org.jboss.seam.jsf.SeamNavigationHandler.handleNavigation(SeamNavigationHandler.java:30)
                     org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:84)
                     javax.faces.component.UICommand.broadcast(UICommand.java:106)
                     org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:274)
                     org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:250)
                     org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:405)
                     org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
                     org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
                     javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
                     org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                     org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                     org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
                     org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
                     org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                    

                    I'm asking because I kept nagging for this being possible a month ago and ended up by making my own pageflow component that parses navigation.xml.

                    IMHO it would be nice to have feature and I could discard my custom pageflow component ;)

                    So is this supposed to work or could it please be added?