2 Replies Latest reply on Nov 26, 2008 12:40 PM by Chris Werner

    Site Navigation History

    Chris Werner Newbie

      Hi,


      I want to add a sort of navigation history to my pages:


      Home::Organization::People::Executives::BartSimpson


      What I want to achieve is that you can click on each of the navigation items to get back to the desired page without using the back button of the browser serveral times. It also provides the user with a a better overview where in the page structure he is located.


      Two questions:
      1.) Is there a method to track the navigation? I could track the page names in a list of course but if the user uses the back button the list gets messed up. Tracking is necessary because you can reach some pages from more than one page.
      2.) Most of the page content is created dynamically. I would prefer not to load everything from the db again but to display the cached pages just like the browser does when clicking the back button.


      Basically, I want to imitate browser behaviour. Is this possible?
      Thank you for your help,
      Chris

        • 1. Re: Site Navigation History
          Darrin Tisdale Newbie
          Chris,

          If I understand what you want, your use case would be like:

          User starts at Home.  (Home is visible in breadcrumbs.)
          User clicks over to an organization.
          User selects people, then Executives, each on a separate page.
          Finally, they click on Bart Simpson.

          Is that right?

          So, if they click People, do they see ...People::Executives::BartSimpson::People (a la breadcrumbs) or just ...People?

          The basic approach--from the "Seam in Action" book, is to use an Observer on the page event.  Then, with each page firing, the observer bean stores a link in the hash.   Just store a reference to the caller, from the ingestion, and you've got breadcrumbs.  If you want the flatten approach--where going back down the tree removes that part from the breadcrumps is simple as well.  Just compare the event coming back as the key in a session maintained map, and you can chop the end off when you jump.

          As for the page caching, this issue really isn't yours.  Use mod_rewrite to set up a mapping on the URLs, restructuring some items (like hanging .html tags).  The browser sees the rewritten URL, and since it's not a CGI-style call, it will cache the page locally.  Now, if you want some kind of cache mechanism on your side, storing chunks of your JSF trees for use, time to break out the JBoss Cache guide.  But be specific about the real need you have.  Because, a user's cache will be faster than yours.

          . . . TizzyD
          • 2. Re: Site Navigation History
            Chris Werner Newbie

            Thank you for the detailed answer.


            I wanted the flatten approach. Otherwise the breadcrumbs will quickly expand to much so I just cut the tree. I will try out your idea now.
            Thx a lot, Chris