<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %> <%@ page import="java.util.Iterator" %> <%-- Menu Layout This layout render a menu with links. This implementation doesn't use any Struts tags. If you also use Struts, please check menu.jsp implementation. It takes as parameter the title, and a list of items. Each item is a bean with following properties : value, href, icon, tooltip. @param title Menu title @param items list of items. Items are beans whith following properties : --%> <%-- Push tiles attributes in page context --%> <% // Make Tile context available for conditional test //ComponentContext tileContext = RequestU %> <% if( pageContext.getAttribute("title")!=null) { %> <% } // end if %> <%-- iterate on items list --%> <% java.util.List list = (java.util.List)pageContext.getAttribute("items"); java.util.Iterator iterator = list.iterator(); while( iterator.hasNext() ) { org.apache.struts.tiles.beans.MenuItem item = (org.apache.struts.tiles.beans.MenuItem)iterator.next(); %> <% // Add site url if link start with "/" String link = item.getLink(); if(link.startsWith("/") ) link = request.getContextPath() + link; %> <% // end iterate } // end loop %>
<% if( item.getIcon()==null) { %> <%=item.getValue()%> <% } else { %> <% // Add site url if link start with "/" String icon = item.getIcon(); if(icon.startsWith("/") ) icon = request.getContextPath() + icon; %> <%=request.getContextPath()+item.getTooltip()%> <% } // end if %>