[opencms-dev] How to Create a navigation menu

mohamed hadj taieb mohamedhajjj at gmail.com
Mon Feb 19 11:30:44 CET 2007


Hi i want to create a navigation menu with OpenCMS by using this code

########################### menu code ##########

<%@ page session="false"

import="java.util.Iterator,

java.util.List,

org.opencms.jsp.CmsJspNavBuilder,

org.opencms.jsp.CmsJspNavElement,

org.opencms.jsp.CmsJspActionElement"

%>

<%

/*

* Provides basic site navigation.

*/

// Create the class from which we will get navigation.

CmsJspActionElement cms =

new CmsJspActionElement( pageContext, request, response );

// Get navigation info

CmsJspNavBuilder navigation = cms.getNavigation();

List navItems = navigation.getNavigationForFolder();

Iterator i = navItems.iterator();

// Loop through all of the items in the ArrayList and print the

// menu.

while( i.hasNext() ) {

CmsJspNavElement navElement = ( CmsJspNavElement )i.next();

String link = cms.link( navElement.getResourceName() );

String title = navElement.getTitle();

out.println("»<a href=\"" + link + "\">" + title + "</a><br/>");

}

%>
########################### end menu code ######

when testing i dont get nothing in the content of the menu
i cheked the value of the bolean : i.hasnext() i found it false and i don t
understand why

if someone have an idea about the problem or have an other example to create
a menu i will be grateful for his help

Cordially
Mohamed HADJ TAIEB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20070219/eeb5a533/attachment.htm>


More information about the opencms-dev mailing list