How to both expand child nodes and select a page

Technote (FAQ)


Question

In the WebSphere® Portal 6.0 themes, you notice that there is a link for expanding children nodes, then another link for selecting a page. You can either expand the children, or select a page, but not both.

Answer

Many times you will want portal to both open the page and expand its children when selecting a page. With the current navigation tags, you cannot do this. Now you can use the Navigation SPI to do this. For more information on the Navigational State SPI, refer to "Leveraging WebSphere Portal V6 programming model: Part 2. Advanced URL generation in themes and portlets"
In the example below, we have modified the SPI to select the page as well as expand the node if it has children.

In the sidenav.jspf, we modified the code to generate the links to the pages as follows:

<c-rt:choose>
<c-rt:when test="<%=nodeHasChildren && !isExpanded %>">
<%String url = "";
url = ServletURLGenerator.generateUrlStringWithExpansion(wpsNavNode, true, request, response); %>
<a class="<%=rowCssClass%> wpsNavLevel<%=wpsNavLevel%>" href="<%=url%>"><c:out value='${sideNavItemTitle}' escapeXml='true' /></a>
</c-rt:when>
<c-rt:otherwise>
<a class="<%=rowCssClass%> wpsNavLevel<%=wpsNavLevel%>" href="<portal-navigation:navigationUrl type="launch"/>" <% if (openInNewWindow) {%>target="_blank"<% } %> <% if (isNodeSelected) { %>onfocus="showPageAffordance()" <% } %> >
<c:out value='${sideNavItemTitle}' escapeXml='true' />
</a>
</c-rt:otherwise>
</c-rt:choose>

This code calls the SPI to create a URL to a page and expand the node.

Attached is the jspf and the URL that calls the helper classes. To use this example, you need to put the helper class jar into shared/app and then replace the sidenav jspf with the attached one. This code will also cause the unselected page to collapse.
sideNav.jspfURLUTIL60.jar

Rate this page:

(0 users)Average rating

Document information


More support for:

WebSphere Portal End of Support Products
WebSphere Portal

Software version:

6.0, 6.0.0.0, 6.0.0.1, 6.0.1, 6.0.1.0, 6.0.1.1

Operating system(s):

AIX, HP-UX, Linux, Solaris, Windows, i5/OS, z/OS

Software edition:

Enable, Express, Extend, Server

Reference #:

1283387

Modified date:

2013-08-03

Translate my page

Machine Translation

Content navigation