4 Replies Latest reply on May 16, 2007 5:22 PM by delphi'sghost

    Breadcrumbs

      Hello,

      I'm having some difficulty w/breadcrumbs. I copied from the issues example and from the documentation.

      My pages.xml file looks like this:

      <!DOCTYPE pages PUBLIC
       "-//JBoss/Seam Pages Configuration DTD 1.2//EN"
       "http://jboss.com/products/seam/pages-1.2.dtd">
      
      <pages>
       <page view-id="/home.xhtml">Home</page>
       <page view-id="/Timezones.xhtml">World Time</page>
       <page view-id="/Foo.xhtml">FooBar</page>
      </pages>
      


      In my nav area (where I want the breadcrumbs) I have code that looks like this:
       <form>
       <t:dataList value="#{conversationStack}" var="entry">
       <h:outputText value=" | "/>
       <t:commandLink value="#{entry.description}" action="#{entry.select}"/>
       </t:dataList>
       </form>
      

      (Tomahawk is installed and working fine for my application.)

      If I nav to path "Home | World Time | FooBar" I should see breadcrumbs accordingly. Instead on FooBar page my breadcrumbs link shows only "World Time" (but not Home and no FooBar). The value of the "World Time" link is FooBar (current page), which is wrong--should be the world time page.

      Any ideas what I might be doing wrong?

      Thanks,
      Greg

        • 1. Re: Breadcrumbs

          Are you using nested conversations?

          • 2. Re: Breadcrumbs

            I wasn't using nested conversations. I'm 100% in xhtml (not touching any Java code at this point in my app) so I changed my pages.xml to look like this:

            <pages>
             <page view-id="/home.xhtml">Home
             <begin-conversation nested="true"/>
             </page>
             <page view-id="/Timezones.xhtml">World Time
             <begin-conversation nested="true"/>
             </page>
             <page view-id="/Foo.xhtml">FooBar
             <begin-conversation nested="true"/>
             </page>
            </pages>
            


            Different things are happening, but still getting non-working behavior. For example World Time page now just has 1 breadcrumb: World Time. FooBar now has 3--Two say World Time and one says FooBar, but all 3 point to Foo.xhml. ???

            • 3. Re: Breadcrumbs
              vralev

              You can try to start the nested conversations when you are launching the links (s:link and s:button with propagation="nest").

              In seam the breadcrumbs simply display the conversation stack. The repeated entries are appearing because you have started the same nested conversation multiple times by re-entering the same page. To avoid repeating entries make sure you don't have any links that point to the page you are currently using (or use propagation="join" on these links instead of starting a new nested conversation).

              • 4. Re: Breadcrumbs
                delphi'sghost

                In pages.xml, anytime you render the page, even as a result of a user interaction with a control (i.e. you are staying on the page), the stuff in pages.xml gets executed for the page each and everytime (for both page flow and conversation tags).The join=true just hides this fact since it tries to start a conversation on each re-render, but since one is already started, it just joins it.

                Conversations started from <begin-conversation> in pages.xml must have the join=true, otherwise you get an error on re-renders due to starting a conversation from a long running conversation, or if nested=true, then you get multiple entries each time you render.

                (Makes you wonder whether that was the plan, and if so, why include two attributes that can do nothing but blow up the application, unless there is a third option of doing a redirect as soon as you hit the page and start the conversation?)

                It kind of makes conversation control in pages. xml useless. The only benefit it provides is for RESTful URLs so if the user opens a browser window, and enters the url, as soon as you hit that page it starts the conversation (without needing @Begin methods and so on). There are alternative ways of doing this though such as annotating a method in the main action bean for that page with @Create @Begin.

                If you do have <begin-conversation> in pages.xml, set it as join=true, then, when you navigate through, you need to either put the conversation in the link, or call methods annotated with @Begin(nested=true) so they can pre-start the conversation that you will join when you get to the page and the <begin-conversation join=true> is invoked.

                Of course, throw page flows into the mix, and things get really interesting, since then you need to start maintaining two sets of pageflow documents, one for the conversation in pages.xml, and one for your @Begin annotated conversations. At this point, you should probably just pick conversation control in methods and bag pages.xml.

                At times, Seam seems to suffer from the tool developers myopia on some conversation/pageflow issues. However, it's still an improvement on doing it yourself!