<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/struts-menu.tld" prefix="menu" %>
<%@ taglib uri="/WEB-INF/struts-menu-el.tld" prefix="menu-el" %>
<%@ page import="java.util.Map,
javax.servlet.jsp.jstl.sql.Result,
net.sf.navigator.menu.MenuComponent,
net.sf.navigator.menu.MenuRepository"%>
<%
MenuRepository repository = new MenuRepository();
MenuRepository defaultRepository = (MenuRepository)
application.getAttribute(MenuRepository.MENU_REPOSITORY_KEY);
repository.setDisplayers(defaultRepository.getDisplayers());
MenuComponent parentMenu = new MenuComponent();
parentMenu.setName("parent");
parentMenu.setTitle("parent");
for (int i=0; i < 3; i++) {
MenuComponent mc = new MenuComponent();
mc.setName("StandaloneMenu" + i);
mc.setTitle("StandaloneMenu" + i);
mc.setParent(parentMenu);
for (int j=0; j < 4; j++) {
MenuComponent mc1 = new MenuComponent();
mc1.setName("StandaloneMenu" + j);
mc1.setTitle("StandaloneMenu" + j);
mc1.setParent(mc);
repository.addMenu(mc1);
}
repository.addMenu(mc);
}
repository.addMenu(parentMenu);
pageContext.setAttribute("repository", repository);
%>
<html>
<title>Dynamic, Database-driven Menu</title>
<link rel="stylesheet" type="text/css" media="all"
href="/styles/menuExpandable.css"/>
<script type="text/javascript"
src="/scripts/menuExpandable.js"/></script>
<link rel="stylesheet" type="text/css" media="all"
href="/styles/xtree.css"/>
<script type="text/javascript"
src="/scripts/xtree.js"/></script>
<body>
<div class="dynamicMenu">
<menu:useMenuDisplayer name="ListMenu" repository="repository">
<menu:displayMenu name="parent"/>
</menu:useMenuDisplayer>
</div>
</body>
</html>