I have jstl code and it builds by maven well... But Eclipse had compilation error \"Unknown tag (c:foreach).\"
code are here:
<%@ page language=\
I was also getting this warning in eclipse. I was also getting other warnings such as:
Unknown tag
(c:if)
or Unknown tag(c:set)
etc.
To fix these warning in eclipse, all i did was to include the following dependency in my pom file. Please note that I am using the servlet 2.5 api.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
You seem to be using <provided>
for this dependency in your pom file. Maybe that's causing your problem ?
Same thing was happening to me in Eclipse. It dissapeared after I deleted the white space between <%@ and taglib that appears in your code.
So now it appears like this and the warning is gone:
the correct tag is case sensitive. (c:forEach)
What you actually need is to add the following line on top of your JSP files:
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
Also, you need to download the JSTL jar files from here and add them to WEB_INF/lib
folder.
Found my answer here: https://stackoverflow.com/a/8400733/3758439