-1

Servlet code snippet:

// check/get session
    HttpSession session = request.getSession();
    ArrayList<LineItem> transactions = (ArrayList<LineItem>)session.getAttribute("transactions");
.....
// set session
session.setAttribute("transactions", transactions);

JSP code snippet:

<%@ 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>

Exception:

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

I'm using JSTL 1.0 (declared in manifest and verified the .jar file). Any suggestions?

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
Justin Heist
  • 13
  • 1
  • 2

1 Answers1

1

The error message is clear:

Attribute transactions invalid for tag forEach according to TLD

The problem is here:

<c:forEach var="item" transactions="${transactions}">
<!--                  ^ there is no such attribute -->

Change transactions by items:

<c:forEach var="item" items="${transactions}">
Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332