I am using a <c:forEach>.....</c:forEach>
tag in the following .jsp file and receiving unknown tag c:forEach
. I am using maven and have the following dependency included:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
and my simple .jsp file looks as follows:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h3>Senior Design Project</h3>
<br>
<form action="query" method="post" commandName="queryForm">
Enter an SQL Query: <br> <br>
<textarea name="query" path="query" cols="55" rows="3"
style="overflow: hidden"></textarea>
<br> <input type="submit" value="submit">
</form>
<h3>Results:</h3>
<br>
<h5>File Paths:</h5>
<c:forEach var="individualPath" items="${paths}">
<tr>
<td>${individualPath}</td>
</tr>
</c:forEach>
</body>
</html>
Is there more setup needed for jstl? From what I've read the maven dependency should handle everything. Help is greatly appreciated.
the taglib
at the top of the .jsp page needs to be included as follows:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h3>Senior Design Project</h3>
<br>
<form action="query" method="post" commandName="queryForm">
Enter an SQL Query: <br> <br>
<textarea name="query" path="query" cols="55" rows="3"
style="overflow: hidden"></textarea>
<br> <input type="submit" value="submit">
</form>
<h3>Results:</h3>
<br>
<h5>File Paths:</h5>
<c:forEach var="individualPath" items="${paths}">
<tr>
<td>${individualPath}</td>
</tr>
</c:forEach>
</body>
</html>