Project Tiles has retired. For details please refer to its Attic page.
Apache Tiles - Framework - Tiles Menu-ing support

Menu-ing support

Tiles offers a (pretty small) support to create menus. It consists in allowing creation of menu-like beans, to be defined in Tiles definition files, using the <item> element:

<definition name="my.definition" layout="/layout/my-template.jsp">
  <put-list-attribute name="myListAttribute">
    <item value="Home page" link="menu.do" />
    <item value="News" link="news.do" />
  </put-list-attribute>
</definition>

To use it, in your JSP pages include:

<tiles:importAttribute name="myListAttribute />
<c:forEach var="item" items="${myListAttribute}">
  <a href="${item.link">${item.value}</a>
  <br/>
</c:forEach>

That's it!