【发布时间】:2014-12-15 23:38:26
【问题描述】:
Servlet 代码 sn-p:
// check/get session
HttpSession session = request.getSession();
ArrayList<LineItem> transactions = (ArrayList<LineItem>)session.getAttribute("transactions");
.....
// set session
session.setAttribute("transactions", transactions);
JSP代码sn-p:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
.....
<c:forEach var="item" transactions="${transactions}">
<tr>
<td>${item.action}</td>
<td>${item.product.getCode}</td>
<td>${item.product.getArtist}</td>
<td>${item.product.getTitle}</td>
<td>${item.product.getCategory}</td>
<td>${item.product.getDescription}</td>
<td>${item.product.getPriceCurrency}</td>
</tr>
</c:forEach>
例外:
SEVERE: Servlet.service() for servlet [jsp] in context with path [/Maintenance] threw exception [/product_audit.jsp (line: 52, column: 4) Attribute transactions invalid for tag forEach according to TLD] with root cause
org.apache.jasper.JasperException: /product_audit.jsp (line: 52, column: 4) Attribute transactions invalid for tag forEach according to TLD
我正在使用 JSTL 1.0(在清单中声明并验证了 .jar 文件)。有什么建议吗?
【问题讨论】:
-
编辑你的 foreach 循环 like=
标签: java eclipse jsp jstl taglib