未知标签(c:foreach)。在日食 [英] Unknown tag (c:foreach). in eclipse
本文介绍了未知标签(c:foreach)。在日食的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有jstl代码,它由maven好建立...但Eclipse有编译错误未知标签(c:foreach)。
代码在这里:
<%@ page language =javacontentType =text / html; charset = ISO-8859-1
pageEncoding =ISO-8859-1%>
<%@ taglib uri =http://java.sun.com/jsp/jstl/coreprefix =c%>
<!DOCTYPE html PUBLIC - // W3C // DTD HTML 4.01 Transitional // ENhttp://www.w3.org/TR/html4/loose.dtd\">
< html>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = ISO-8859-1>
< title>在此插入标题< / title>
< / head>
< body>
< ul>
< c:forEach items =$ {listOfMyFriends}var =friend>
< c:out value =$ {friend}>< / c:out>
< / c:forEach>
< / ul>
< / body>
< / html>
有人可以帮我避免这个提议吗?
有完整的pom:`
http://maven.apache.org/xsd/maven-4.0.0.xsd>
4.0.0
< groupId> com.godzevych< / groupId>
< artifactId> springInActionMVCTemplate< / artifactId>
< version> 0.0.1 -SNAPSHOT< / version>
< package> war< / packaging>
< name> springInActionMVCTemplate< / name>
< url> http:// maven。 apache.org< / url>
< properties>
< java.version> 1.6< / java.version>
< spring.version> 3.1.0 .RELEASE< /spring.version>
< cglib.version> 2.2.2< / cglib.version>
< / properties>
< dependencies>
<! - Spring core& mvc - >
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-context< ; / artifactId的& GT;
< version> $ {spring.version}< / version>
< / dependency>
<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-webmvc< / artifactId>
< version> $ {spring.version}< / version>
< / dependency>
<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-orm< / artifactId>
< version> $ {spring.version}< / version>
< type> jar< / type>
< scope> compile< / scope>
< / dependency>
<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-test< / artifactId>
< version> $ {spring.version}< / version>
< type> jar< / type>
< scope> test< / scope>
< / dependency>
<! - 用于@Configuration的CGLib - >
<依赖关系>
< groupId> cglib< / groupId>
< artifactId> cglib-nodep< / artifactId>
< version> $ {cglib.version}< / version>
< scope>运行时< / scope>
< / dependency>
<! - Servlet规范 - >
<依赖关系>
< groupId> javax.servlet< / groupId>
< artifactId> servlet-api< / artifactId>
< version> 2.5< / version>
< scope>已提供< / scope>
< / dependency>
<! - JSTL - >
<依赖关系>
< groupId> javax.servlet< / groupId>
< artifactId> jstl< / artifactId>
< version> 1.2< / version>
< scope>已提供< / scope>
< / dependency>
<! - JSR 330 - >
<依赖关系>
< groupId> javax< / groupId>
< artifactId> javaee-api< / artifactId>
< version> 6.0< / version>
< / dependency>
< / dependencies>
< repositories>
< repository>
< id> springsource-milestones< / id>
< name> SpringSource里程碑代理< / name>
< url> https://oss.sonatype.org/content/repositories/springsource-milestones< / url>
< / repository>
< / repositories>
< build>
< finalName> springInActionMVCTemplate< / finalName>
< plugins>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
< version> 2.0.2< / version>
< configuration>
< source> $ {java.version}< / source>
< target> $ {java.version}< / target>
< / configuration>
< / plugin>
< / plugins>
< / build>
`
解决方案
在Eclipse中发生了同样的事情。我删除了您的代码中出现的<%@和taglib之间的空白区域。
所以现在看起来像这样,并且警告消失了: p>
I have jstl code and it builds by maven well... But Eclipse had compilation error "Unknown tag (c:foreach)."
code are here:
<%@ 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>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<ul>
<c:forEach items="${listOfMyFriends}" var="friend">
<c:out value="${friend}"></c:out>
</c:forEach>
</ul>
</body>
</html>
could someone help me to avoid this promlem?
There are full pom: ` http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
<groupId>com.godzevych</groupId>
<artifactId>springInActionMVCTemplate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>springInActionMVCTemplate</name>
<url>http://maven.apache.org</url>
<properties>
<java.version>1.6</java.version>
<spring.version>3.1.0.RELEASE</spring.version>
<cglib.version>2.2.2</cglib.version>
</properties>
<dependencies>
<!-- Spring core & mvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<!-- CGLib for @Configuration -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>${cglib.version}</version>
<scope>runtime</scope>
</dependency>
<!-- Servlet Spec -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- JSTL -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<!-- JSR 330 -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>springsource-milestones</id>
<name>SpringSource Milestones Proxy</name>
<url>https://oss.sonatype.org/content/repositories/springsource-milestones</url>
</repository>
</repositories>
<build>
<finalName>springInActionMVCTemplate</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
`
解决方案
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:
这篇关于未知标签(c:foreach)。在日食的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文