4 Replies Latest reply on Aug 28, 2009 4:30 AM by tomhombergs

    How to implement BreadCrumb

    sanupraatiy

      Hi All

      I am using 2.6.4 version of JBoss Portal and want to implement the 'where are you now'(BreadCrumb) functionality for easy back navigation.
      I read few posts but din't get any idea for implementation.
      I understood the breadcrumb used in the portal admin side but they are hardcoding the path on every template(.xhtml).
      I want to create it dynamically so that the changes that has been done at one screen should remain same when user comes back to that screen using breadcrumb.This functionality is not available at admin side.

      Please let me know if anybody has any idea about this.
      Any help will be appreciated.





        • 1. Re: How to implement BreadCrumb
          psevestre

          I did it creating a custom tabs.jsp which gets injected into your pages when you use the "navigation" region in your layout.

          Beginning with the current node, a while loop goes back to the root PortalNode, adding all intermediate nodes into a list.

          After that I reverse the list and use it to build a "You´re here" list of links.




          • 2. Re: How to implement BreadCrumb
            lentinig

            I have created a custom tabs.jsp for my application but i don't know how i get the current node from the PortalNode or other. I use jboss portal 2.7. Can you help me please?

            Thanks a lot

            • 3. Re: How to implement BreadCrumb

               

              "lentinig" wrote:
              I have created a custom tabs.jsp for my application but i don't know how i get the current node from the PortalNode or other. I use jboss portal 2.7. Can you help me please?

              Thanks a lot


              As i have the same problem i would like to know the same...

              • 4. Re: How to implement BreadCrumb

                I have implemented breadcrumbs as a separate Portlet to be included in the content area of my layout.

                The portlet merely iterates from the current PortalNode up to the PortalNode representing the portal itself and outputs the links.

                Simplified, you could do the following in your BreadCrumbPortlet's doView-Method (untested):

                PortalNode pageNode = Navigation.getCurrentNode().getParent();
                while (pageNode.getType() != PortalNode.TYPE_PORTAL) {
                 String pageUrl = pageNode.createURL(Navigation.getPortalRuntimeContext()).toString());
                 response.getWriter().println("<a href="+pageUrl+">"+pageNode.getDisplayName(request.getLocale())+"</a>");
                 pageNode = pageNode.getParent();
                }
                


                I implemented it using JSF, however.