Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Currently on isda-cs2 there is a Web Project called NavigationFrameworkTest which has a draft version of the navigation framework running on it.  Here's a link to a preview of the site index page in my sandbox: http://jcalz.navtest.www--sandbox.18-92-1-223.ip.alfrescodemo.net:8180/sitetree.jsp

There is a "navigation.jar" file which must live in the /WEB-INF/lib directory of the webapp.  It defines a JSP tag library which can be used to get navigation/breadcrumb/sitetree information.  This library causes the webapp to crawl its structure constantly in the background (on a low priority thread).  The webapp periodically updates a global "SiteTree" object representing all the navigation information about the site.  

Panel

 In the virtualization server environment with many webapps, this can be slow.  That means that for people using the Preview button, you may have to wait some time before any changes to the global SiteTree are picked up.  This does not mean that people have to wait to see something; just that they see an older version of the information.  If they refresh after enough time has gone by, they will see the newest information.  
 On a production system, which is running (probably) just the one webapp, this will be fast.  I have tested this system on a Tomcat instance running on a local machine, crawling a site with 3,000 files in it.  It took approximately one half of a second between updates.  Again, no user has to wait an extra half of a second for their browser to show a page; the page will be rendered at the normal time, but with information which may be up to a half of a second old.

The web application automatically generates navigation information for your web project.  If you do not tell it to do something differently, it will generate default titles for the sections and pages in your site.  By default, every folder (except META-INF and WEB-INF) in the site will be a Section whose title is the same as the name of the folder.  Also, every file (*note to self: probably should make this just .html, .htm, .xhtml, .jsp, or .jspx files) in the site will be a Page whose title is the same as the name of the file (without the extension).  In some cases this will be what you want.  In other cases, you will want to alter the default behavior by controlling the navigation information yourself.

...

That's all there is to it for content authors. 

Webapp developers will primarily deal with the navigation framework JSP tags and the beans they expose. 

...

Code Block
<%@taglib uri="http://web.mit.edu.ezproxyberklee.flo.org/ist/isda/tags/navigation" prefix="nav" %>

The following section describes all the tags in the navigation tag library.

 This <nav:setSiteTreeVar> action sets a scoped variable to the object representing the site tree.  The site tree bean is useful for a JSP which generates a Site Index or Site Map page.  Once you have set a variable to the site tree bean, you can walk through it with the <nav:treeWalk> and <nav:subTreeWalk> tags.

...

No Format
<nav:setSiteTreeVar var="theSiteTree" />
The Site Tree was last updated at <fmt:formatDate value="${theSiteTree.lastUpdated}" pattern="h:mm:ss a" />

The <nav:treeWalk> and <nav:subtreeWalk> actions allow you to recursively walk through the site tree (or any tree structure). The idea is that the body of the <nav:treeWalk> tag is performed for every branch of the tree. The body of the <nav:treeWalk> tag must contain the <nav:subtreeWalk> tag, which indicates where to include the sub-branches in the tree walk. It's much easier to look at an example than to explain what I mean.

...

No Format
<nav:setSiteTreeVar var="theSiteTree" />
<h3><ul><li>
  <nav:treeWalk root="${theSiteTree.homeSection}" var="page">
     <a href="${page.url}"         ><c:out value="${page.title}" /></a>:<br/>
       <ul><c:forEach items="${page.subpages}" var="subpage">
         <li><nav:subtreeWalk subroot="${subpage}" /></li>
       </c:forEach></ul>
  </nav:treeWalk>
</li></ul></h3>

 This <nav:setBreadcrumbVar> action sets a scoped variable to an object representing the breadcrumb for a particular target url in the site.   In this case, the breadcrumb object is a list of the target's ancestor pages, starting from the home page of the site and ending at the target page.  This is useful for a JSP which generates a breadcrumb for the current page.   Once you have set a variable to a breadcrumb object, you can iterate through it within a <c:forEach> tag.

...

No Format
<nav:setBreadcrumbVar var="breadcrumb" />
<c:forEach var="page" items="${breadcrumb}" varStatus="status">
<c:if test="${not status.first}">&gt;</c:if><a href="${page.url}"      ><c:out value="${page.title}" /></a>
</c:forEach>

 This <nav:setPageVar> action sets a scoped variable to an object representing the navigation information for a particular target url in the site.   This is useful for a JSP which needs to know, for example, the list of links for the current page or section.  

...

No Format
<nav:setPageVar var="page"/>
<c:forEach var="subpage" items="${page.subpages}" >
&bull; <a href="${subpage.url}"      ><c:out value="${subpage.title}" /></a><br/>
</c:forEach>

This section details the various object beans which can be exposed through the above tags.  Unless stated otherwise, these objects are in the edu.mit.isda.navigation package.  Also, all properties of these objects are read-only.  You cannot alter them in any way within a JSP.

This is an object representing the site tree.  There is really only one important property here: homeSection, which corresponds to the topmost url (usually "/") in the site.

...