Unknown tag (c:foreach). in eclipse

前端 未结 4 794
终归单人心
终归单人心 2020-12-09 20:40

I have jstl code and it builds by maven well... But Eclipse had compilation error \"Unknown tag (c:foreach).\"

code are here:

<%@ page language=\         


        
相关标签:
4条回答
  • 2020-12-09 20:43

    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 ?

    0 讨论(0)
  • 2020-12-09 20:46

    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:

    0 讨论(0)
  • 2020-12-09 20:48

    the correct tag is case sensitive. (c:forEach)

    0 讨论(0)
  • 2020-12-09 20:54

    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

    0 讨论(0)
提交回复
热议问题