1 Reply Latest reply on Jul 17, 2009 12:32 PM by Julien Kronegg

    a4j:include navigation setup

    Christopher Logan Newbie

      When I setup a page using a4j:include to navigate 4 view-ids.  I put the navigation rules into the coarse grained view.page.xml file and the navigation didn't work.  I then commented out the rules in the file and placed them into pages.xml and the navigation worked.


      For example:


      list.xhtml contained:


      <a4j:commandLink value="View" action="view" />
      <a4j:commandLink value="Add" action="add" />
      <a4j:commandLink value="Edit" action="edit" />
      <a4j:commandLink value="Delete" action="delete" />
      



      list.page.xml originally contained:


      <?xml version="1.0" encoding="UTF-8"?>
      <page 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"
          >
          <navigation>
              <rule if-outcome="add">
                  <render view-id="/add.xhtml"/>
              </rule>
              <rule if-outcome="view">
                  <render view-id="/view.xhtml"/>
              </rule>
              <rule if-outcome="edit">
                  <render view-id="/edit.xhtml"/>
              </rule>
              <rule if-outcome="delete">
                  <render view-id="/delete.xhtml"/>
              </rule>
          </navigation>
      </page>
      



      navigation didn't work.  I commented out the navigation in list.page.xml
      and included the rules in pages.xml:


          <page view-id="list.xhtml" >
              <navigation>
                  <rule if-outcome="add">
                      <render view-id="/add.xhtml"/>
                  </rule>
                  <rule if-outcome="view">
                      <render view-id="/view.xhtml"/>
                  </rule>
                  <rule if-outcome="edit">
                      <render view-id="/edit.xhtml"/>
                  </rule>
                  <rule if-outcome="delete">
                      <render view-id="/delete.xhtml"/>
                  </rule>
              </navigation>
          </page>
      



      Navigation worked!  Please let me know if this is the only way to define
      navigation for a4j:include.  Or, did I do something wrong?


      It would be nice if the navigation can be specified in list.page.xml as well.


      Thank you,
      Christopher

        • 1. Re: a4j:include navigation setup
          Julien Kronegg Novice

          When using facelet include, e.g. <ui:include src="/list.xhtml">, the list.page.xml file is not used. Only the main page's .page.xml is used. This might be the same in the case of a4j:include.


          In your example, it is not clear where you use the a4j:include. Does view.xhtml includes list.xhtml? In that case and interpolating from the ui:include behavior, you should have your navigation rules in view.page.xml or in the global pages.xml, but not in the list.page.xml (since this last file is not used in case of include).