Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

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 (in a low priority thread).  The webapp periodically updates a global "SiteTree" object representing all the navigation information about the site.  

Note
titleNote

 In the virtualization server environment with many webapps, this can be slow.  That means that people using the Preview button may have to wait some time before any changes to the global SiteTree are picked up.  This does not mean that they have to wait to see something; they just 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 in the site with an "html-like" extension (one of "jsp", "jspf", "jspx", "htm", "html", "xht", "xhtm", "xhtml", "sht", "shtm", or "shtml") will be a Page whose title is the same as the name of the file without the extension.  In some cases this default behavior will be what you want.  In other cases, you will want to alter the default behavior by controlling the navigation information yourself:

You may control the navigation information on a per-folder level in your Alfresco Web Project via the web form named "Navigation Information".  This web form manages a file in the current folder called "navigation.xml".  If you have just created a new folder and you want to control its navigation information, you must choose Create > Create Web Content:
Image Added
 
Then you should create content via the "Navigation Information" web form as shown below:

Image Added

Warning
titleNote

The information in the "Name:" field is ultimately ignored; the output file will always be named "navigation.xml".  Unfortunately the "Name" field is mandatory, so you are forced to type something in there.  Sigh.

If you have already created the navigation.xml file for a folder and you want to alter it, you can do so by clicking the edit (pencil) icon on the navigation.xml file:

Image Added
 

Warning
titleNote

If, instead, you perform the "create web content" steps, you will end up clobbering the existing navigation.xml file.  It is more likely you'd rather edit the file than write over it, but it's up to you.


The form for editing/creating the navigation.xml file is shown below:
Image Added
There are three types of fields to be filled out.

The first is the Section Title.  The current folder corresponds to a Section in the site tree.  If you want the title of this Section to be something other than the name of the folder, enter it here.

The next type of field is a list of Links.  A Link consists of a Url and a Title.  You may enter as many Links as you'd like.  These will generally end up as Pages under the current section, in the order they appear in this web form.  There are several ways you can use Links to alter the default page naming behavior.

  • To change the title of a Page which is already included in the current Section: type the url for the page (either the full root-relative url e.g.,"/foo/bar/baz.html"

...

  • or

...

  • just

...

  • the

...

  • file

...

  • name

...

  • e.g.,

...

  • "baz.html")

...

  • in

...

  • the

...

  • Url

...

  • field

...

  • and

...

  • a

...

  • new

...

  • title

...

  • in

...

  • the

...

  • Title

...

  • field.

...

  • To

...

  • add

...

  • a

...

  • Page

...

  • which

...

  • is

...

  • not

...

  • currently

...

  • included

...

  • in

...

  • the

...

  • current

...

  • Section,

...

  • because

...

  • it

...

  • is

...

  • has

...

  • a

...

  • non-html-like

...

  • file

...

  • extension:

...

  •   type

...

  • the

...

  • url

...

  • for

...

  • the

...

  • page

...

  • (either

...

  • the

...

  • full

...

  • root-relative

...

  • url

...

  • for

...

  • the

...

  • page,

...

  • e.g.,

...

  • "/foo/bar/baz.txt",

...

  • or

...

  • just

...

  • the

...

  • file

...

  • name

...

  • e.g.,

...

  • "baz.txt")

...

  • into

...

  • the

...

  • Url

...

  • field

...

  • and

...

  • the

...

  • desired

...

  • title

...

  • in

...

  • the

...

  • Title

...

  • field.

...

  • To

...

  • add

...

  • a

...

  • Page

...

  • which

...

  • is

...

  • not

...

  • currently

...

  • included

...

  • in

...

  • the

...

  • current

...

  • Section,

...

  • because

...

  • you

...

  • want

...

  • to

...

  • cross-link

...

  • it

...

  • from

...

  • somewhere

...

  • else

...

  • in

...

  • the

...

  • site:

...

  •   type

...

  • the

...

  • full

...

  • root-relative

...

  • url

...

  • for

...

  • the

...

  • page,

...

  • e.g.,

...

  • "/other/folder/thing.html",

...

  • into

...

  • the

...

  • Url

...

  • field

...

  • and

...

  • the

...

  • desired

...

  • title

...

  • in

...

  • the

...

  • Title

...

  • field.

...

  • To

...

  • add

...

  • a

...

  • Page

...

  • which

...

  • is

...

  • not

...

  • currently

...

  • included

...

  • int

...

  • he

...

  • current

...

  • Section,

...

  • because

...

  • it

...

  • is

...

  • a

...

  • link

...

  • to

...

  • an

...

  • external

...

  • web

...

  • page:

...

  • type

...

  • the

...

  • absolute

...

  • url

...

  • for

...

  • this

...

  • page,

...

  • e.g.,

...

  • "http://web.mit.edu.ezproxy.canberra.edu.au/",

...

  • into

...

  • the

...

  • Url

...

  • field

...

  • and

...

  • the

...

  • desired

...

  • title

...

  • in

...

  • the

...

  • Title

...

  • field.

...

  • To

...

  • change

...

  • the

...

  • order

...

  • of

...

  • a

...

  • Page

...

  • or

...

  • a

...

  • Section

...

  • which

...

  • is

...

  • already

...

  • included

...

  • in

...

  • the

...

  • current

...

  • Section:

...

  • enter

...

  • its

...

  • url

...

  • (root-relative

...

  • or

...

  • file

...

  • name)

...

  • into

...

  • the

...

  • Url

...

  • field

...

  • and

...

  • the

...

  • desired

...

  • title

...

  • in

...

  • the

...

  • Title

...

  • field,

...

  • and

...

  • change

...

  • the

...

  • order

...

  • of

...

  • the

...

  • Link

...

  • by

...

  • clicking

...

  • the

...

  • up

...

  • or

...

  • down

...

  • arrow

...

  • buttons

...

  • in

...

  • the

...

  • form.

...

  •  
    Note
    titleNote

    Note that any Links that are explicitly included in the navigation.xml file will come first in the listing for the current Section, before any Sections or Pages which are automatically included by default.  If you want fine-tuned control over the order of all the Sections and Pages within the current Section, you will need to create Links for all of them.

(Does that make sense?  Maybe that was too complicated, but the upshot is this: the Link fields specify the Pages that appear in the current Section.)

Finally, there is a list of Ignore Urls.  These are the urls of files or subfolders that you don't want to be included under the current Section.  Remember that by default, all folders and most html-like files are included in the site tree.  This is a way to turn that behavior off for particular folders and files.  There are two ways you can use Ignore Urls:

  • To ignore a file so that it is not included as a Page: enter its file name e.g., "index-old.html",

...

  • into

...

  • the

...

  • Url

...

  • field.

...

  • To

...

  • ignore

...

  • a

...

  • folder

...

  • so

...

  • that

...

  • it

...

  • is

...

  • not

...

  • included

...

  • as

...

  • a

...

  • child

...

  • Section:

...

  • enter

...

  • the

...

  • folder

...

  • name

...

  • (ideally

...

  • ending

...

  • with

...

  • a

...

  • slash)

...

  • e.g.,

...

  • "junk/",

...

  • into

...

  • the

...

  • Url

...

  • field.

...

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. 

As mentioned above, the navigation.jar file must live in the /WEB-INF/lib

...

directory

...

of

...

the

...

webapp.

...

  The

...

navigation

...

framework

...

tag

...

library

...

is

...

referenced

...

by

...

the

...

symbolic

...

url

...

"http://web.mit.edu.ezproxy.canberra.edu.au/ist/isda/tags/navigation".

...

  In

...

your

...

JSP

...

file,

...

you

...

should

...

declare

...

the

...

tag

...

library

...

like

...

this:

{
Code Block
}
<%@taglib uri="http://web.mit.edu.ezproxy.canberra.edu.au/ist/isda/tags/navigation" prefix="nav" %>
{code}

h3. Navigation objects and properties

This section details the various object beans which can be exposed through the tags in the tag library.&nbsp; Unless stated otherwise, these objects are in the 

This section details the various object beans which can be exposed through the tags in the tag library.  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.

Properties

Name

Type

Description

homeSection

Section

an object representing the Home Page (or Home Section) for the web site.   You can recurse the tree starting from this section using the <nav:treeWalk> and <nav:subtreeWalk tags>.

lastUpdated

java.util.Date

the datestamp when this site tree object was created.   The site tree returned by <nav:setSiteTreeVar> should always be fairly new.   If you are using a cached or stored SiteTree object (not recommended) this could be older.  This property is provided primarily to help webapp developers develop and debug their application.

timeToCreate

long

the time in milliseconds that it took to create this site tree object.  It is a measure of how long it takes for the webapp to crawl the site.  If the servlet container is running many such threads (virtualization server, hint hint) this could be a long-ish time.  This property is provided primarily to help webapp developers develop and debug their application.

This is an object representing a page or a section within the site tree.   The basic object is a Page, which has a title and a URL.  A Section is a special type of Page, which contains subpages.  If a Page is not a Section, it does not contain subpages.  (All Section objects are Pages, but not all Page objects are Sections.)   To ease JSP programming, you can just treat all Sections as Pages, and use the "isASection" and "subpages" properties to access section-specific behavior.

Properties

Name

Type

Description

title

String

the title for this Page or Section.

url

String

the URL for this Page or Section.

breadcrumb

java.util.List<Page>

the breadcrumb for this Page or Section.  This is a List of all this Page's ancestors in the site tree, starting from the Home section and ending at the current Page.  You can iterate through this collection using the <c:forEach> tag in the JSTL.

containingSection

Section

this Page's parent Section.  This is nullif the current Page is the home section (root) of the site tree.  The containingSection has the current Page as one of its subpages.

isASection

boolean

true if the current Page is also a Section (can have subpages).
false if the current Page is not a Section (cannot have subpages).

subpages

java.util.Collection<Page>

if this Page is also a Section: a Collection of all the Pages and Sections contained in this Section.   Every element in this Collection has the current Page as its containingSection.  You can iterate through this collection using the <c:forEach> tag in the JSTL.
if this Page is not also a Section: an empty Collection.

isExternal

boolean

true if the current Page corresponds to a local root-relative url in the current webapp.
false if the current Page corresponds to an external absolute url.

 

The following section describes the tags in the navigation tag library, as well as giving some example of how they are used in conjunction with the above bean properties.

 This <nav:setSiteTreeVar> action sets a scoped variable to the object representing the current 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.

It is not recommended to save the site tree to session or application scope for later use, as it will possibly be stale (if pages have been added or removed without restarting the webapp).  Instead, just use <nav:setSiteTreeVar> again when you need the most recent site tree.

Syntax

<nav:setSiteTreeVar [var="var"] [scope="page|request|session|application"] />

Attributes

Attribute name

Java type

Default
value

Dynamic value
accepted

Description

var

String

"siteTree"

No

The name of the variable to contain the site tree object.

scope

String

"page"

No

The scope for the variable.  It must be one of "page", "request", "session", or "application".

Example

No Format


h4. SiteTree

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

*Properties*
|| Name || Type || Description ||
| homeSection | Section | an object representing the Home Page (or Home Section) for the web site.&nbsp;&nbsp; You can recurse the tree starting from this section using the <nav:treeWalk> and <nav:subtreeWalk tags>. |
| lastUpdated | java.util.Date | the datestamp when this site tree object was created.&nbsp;&nbsp; The site tree returned by <nav:setSiteTreeVar> should always be fairly new. &nbsp; If you are using a cached or stored SiteTree object (not recommended) this could be older.&nbsp; This property is provided primarily to help webapp developers develop and debug their application. |
| timeToCreate | long \\ | the time in milliseconds that it took to create this site tree object.&nbsp; It is a measure of how long it takes for the webapp to crawl the site.&nbsp; If the servlet container is running many such threads (virtualization server, hint hint) this could be a long-ish time.&nbsp; This property is provided primarily to help webapp developers develop and debug their application. |

h4. Page (and Section)

This is an object representing a page or a section within the site tree.&nbsp;&nbsp; The basic object is a Page, which has a title and a URL.&nbsp; A Section is a special type of Page, which contains subpages.&nbsp; If a Page is not a Section, it does not contain subpages.&nbsp; (All Section objects are Pages, but not all Page objects are Sections.) &nbsp; To ease JSP programming, you can just treat all Sections as Pages, and use the "isASection" and "subpages" properties to access section-specific behavior.

*Properties*
|| Name || Type || Description ||
| title | String \\ | the title for this Page or Section. \\ |
| url \\ | String \\ | the URL for this Page or Section. \\ |
| breadcrumb | java.util.List<Page> | the breadcrumb for this Page or Section.&nbsp; This is a List of all this Page's ancestors in the site tree, starting from the Home section and ending at the current Page.&nbsp; You can iterate through this collection using the <c:forEach> tag in the JSTL. \\ |
| containingSection | Section | this Page's parent Section.&nbsp; This is _null{_}if the current Page is the home section (root) of the site tree.&nbsp; The containingSection has the current Page as one of its subpages. \\ |
| isASection \\ | boolean \\ | _true_ if the current Page is also a Section (can have subpages). \\
_false_ if the current Page is not a Section (cannot have subpages). \\ |
| subpages \\
\\ | java.util.Collection<Page> | if this Page is also a Section: a Collection of all the Pages and Sections contained in this Section.&nbsp;&nbsp; Every element in this Collection has the current Page as its containingSection.&nbsp; You can iterate through this collection using the <c:forEach> tag in the JSTL. \\
if this Page is not also a Section: an empty Collection. |
| isExternal | boolean \\ | _true_ if the current Page corresponds to a local root-relative url in the current webapp. \\
_false_ if the current Page corresponds to an external absolute url. \\ |
&nbsp;
\\

h3. Tag descriptions

The following section describes the tags in the navigation tag library, as well as giving some example of how they are used in conjunction with the above bean properties.

h4. <nav:setSiteTreeVar>&nbsp;

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

It is not recommended to save the site tree to session or application scope for later use, as it will possibly be stale (if pages have been added or removed without restarting the webapp).&nbsp; Instead, just use <nav:setSiteTreeVar> again when you need the most recent site tree.

*Syntax*

<nav:setSiteTreeVar \[var="_var_"\] \[scope="*page*\|request\|session\|application"\] />

*Attributes*
|| Attribute name || Java type || Default \\
value \\ || Dynamic value \\
accepted \\ || Description ||
| var | String \\ | "siteTree" | No | The name of the variable to contain the site tree object. \\ |
| scope | String \\ | "page" \\ | No | The scope for the variable.&nbsp; It must be one of "page", "request", "session", or "application". \\ |
*Example*
{noformat}
<nav:setSiteTreeVar var="theSiteTree" />
The Site Tree was last updated at <fmt:formatDate value="${theSiteTree.lastUpdated}" pattern="h:mm:ss a" />
{noformat}

And

...

a

...

possible

...

output

...

for

...

this

...

example:

{
Panel
}

The

Site

Tree

was

last

updated

at

11:17:30

AM {panel} h4.

AM

...

...

...

 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.

It is not recommended to save the breadcrumb to session or application scope for later use, as it will possibly be stale (if pages have been added or removed without restarting the webapp).  Instead, just use <nav:setBreadcrumbVar> again when you need the most recent breadcrumb.

Syntax

<nav:setBreadcrumbVar [url="targetUrl"] [var="var"] [scope="page|request|session|application"] />

Attributes

Attribute name

Java type

Default
value

Dynamic value
accepted

Description

url

String

the url of the currently requested page

No

The url of the page whose breadcrumb is desired.  For best results, this should be a root-relative url beginning with a slash (e.g., "/foo/bar/baz.html").

...

 

var

String

"breadcrumb"

No

The name of the variable to contain the breadcrumb object.

scope

String

"page"

No

The scope for the variable.  It must be one of "page", "request", "session", or "application".

Example

The following example gets and displays a breadcrumb for the currently requested page, since the "url" attribute is not set. 

Tip
titleTip

This can be saved into its own JSP which is included in all JSPs on the web site to give a consistent breadcrumb look and feel and to avoid code duplication.


No Format
 | No | The name of the variable to contain the breadcrumb object. \\ |
| scope | String \\ | "page" \\ | No | The scope for the variable.&nbsp; It must be one of "page", "request", "session", or "application". \\ |
*Example*

The following example gets and displays a breadcrumb for the currently requested page, since the "url" attribute is not set.&nbsp;
{tip:title=Tip} This can be saved into its own JSP which is included in all JSPs on the web site to give a consistent breadcrumb look and feel and to avoid code duplication.
{tip}
\\
{noformat}
<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>
{noformat}
And a possible output for this example:
{panel}
{color:#0000ff}{+}Home{+}{color} {color:#000000}>{color} {color:#0000ff}{+}Pets{+}{color} {color:#000000}>{color} {color:#0000ff}{+}Dogs{+}{color}
{panel}

h4. <nav:setPageVar>&nbsp;

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

It is not recommended to save the page object to session or application scope for later use, as it will possibly be stale (if pages have been added or removed without restarting the webapp).&nbsp; Instead, just use <nav:setPageVar> again when you need the most recent page object.

*Syntax*

<nav:setPageVar \[url=_"targetUrl_"\] \[var="_var_"\] \[scope="*page*\|request\|session\|application"\] />

*Attributes*
|| Attribute name || Java type || Default \\
value \\ || Dynamic value \\
accepted \\ || Description ||
| url | String \\ | the url of the currently requested page or section \\ | No | The url of the desired page.&nbsp; For best results, this should be a root-relative url beginning with a slash (_e.g.,_ " />
<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>

And a possible output for this example:

Panel

Home > Pets > Dogs

 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.  

It is not recommended to save the page object to session or application scope for later use, as it will possibly be stale (if pages have been added or removed without restarting the webapp).  Instead, just use <nav:setPageVar> again when you need the most recent page object.

Syntax

<nav:setPageVar [url="targetUrl"] [var="var"] [scope="page|request|session|application"] />

Attributes

Attribute name

Java type

Default
value

Dynamic value
accepted

Description

url

String

the url of the currently requested page or section

No

The url of the desired page.  For best results, this should be a root-relative url beginning with a slash (e.g., "/foo/bar/baz.html").

...

 

var

String

"page"

No

The name of the variable to contain the page object.

scope

String

"page"

No

The scope for the variable.  It must be one of "page", "request", "session", or "application".

Example

The following example displays a bulleted list of all links underneath the currently requested page, since the "url" attribute is not set. 

Tip
titleTip

This can be saved into its own JSP which is included in all JSPs on the web site to give a consistent subnavigation look and feel and to avoid code duplication.


No Format
 | No | The name of the variable to contain the page object. \\ |
| scope | String \\ | "page" \\ | No | The scope for the variable.&nbsp; It must be one of "page", "request", "session", or "application". \\ |
*Example*

The following example displays a bulleted list of all links underneath the currently requested page, since the "url" attribute is not set.&nbsp;
{tip:title=Tip} This can be saved into its own JSP which is included in all JSPs on the web site to give a consistent subnavigation look and feel and to avoid code duplication.
{tip}
\\
{noformat}
<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>
{noformat}

And

...

a

...

possible

...

output

...

for

...

this

...

example

...

:

Panel
  • German Shepherds
  • Google for dogs!
  • Beagles
  • Labradors