Uploaded image for project: 'Tiles'
  1. Tiles
  2. TILES-590

How to Render tiles <put-list-attribute> in template jsp

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 3.0.7
    • None
    • None
    • None

    Description

      HI,
      We are planning to use spring 4.x and Apache tiles 3.0 in struts to spring migration project.
      We have requirement to render side Menu navigation dynamically.
      For that, we defined list attribute which have value and link.
      Can you please suggest correct way to render menu side navigation dynamically using <put-list-attribute>?

      Below is sample tiles definition

      tiles.xml

      <definition name="manage.menu" path="/WEB-INF/Jsp/tiles/subMenuItems.jsp">
      <put name="menuName" value="Manage" />
      <put-list-attribute name="items">
      <add-attribute id=" Member Services " value="xxxxxxxxxxxxxxxxxx"></add-attribute>
      <add-attribute id="Account Preferences " value="dd"></add-attribute>
      </put-list-attribute>
      </definition>

      trying to render list attribute as below but it’s not displaying value / name in template jsp.

      subMenuItems.jsp

      <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

      <tiles:importAttribute name="items"/>
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      </head>
      <body>
      <c:forEach var="item" items="${items}">
      ${item}
      <c:out value="${item.value}"></c:out>
      <c:out value="${item.id}"></c:out>
      <c:out value="${id}"></c:out>
      <c:out value="${value}"></c:out>
      <br />
      </c:forEach>
      </body>
      </html>

      Output for above code:

      ${item} ${item.value} ${item.id} ${id} ${value}

      ${item} ${item.value} ${item.id} ${id} ${value}

      Thanks,
      Mahesh Boggala

      Attachments

        Activity

          People

            Unassigned Unassigned
            mboggala Mahesh Boggala
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment