Mahesh Boggala created TILES-590:
------------------------------------
Summary: How to Render tiles <put-list-attribute> in template jsp
Key: TILES-590
URL: https://issues.apache.org/jira/browse/TILES-590
Project: Tiles
Issue Type: Task
Reporter: Mahesh Boggala
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
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)