[英]Java EE 7 : Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core”
I am trying to use the following tag lib in my JSP page : 我试图在我的JSP页面中使用以下标记库:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
But Eclipse shows me this error : 但是Eclipse向我显示了此错误:
Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
I am already having JSTL in my classpath using this dependency : 我已经使用此依赖项在我的类路径中有了JSTL:
<dependency>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
I use WildFly 9. 我使用WildFly 9。
I have the same problem with these 2 other taglibs : 我对这两个其他taglib有相同的问题:
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
Remark : The following link is giving 404 HTTP error : http://central.maven.org/maven2/javax/servlet/jsp/jstl/jstl/1.2/jstl-1.2.jar 备注 :以下链接给出了404 HTTP错误: http : //central.maven.org/maven2/javax/servlet/jsp/jstl/jstl/1.2/jstl-1.2.jar
Thank you. 谢谢。
If your web application uses JSTL directly, for JSTL 1.0, the namespace is http://java.sun.com/jstl/core . 如果您的Web应用程序直接使用JSTL,则对于JSTL 1.0,名称空间为http://java.sun.com/jstl/core 。 In JavaEE 5, JSTL 1.1 is included, the namespace is http://java.sun.com/jsp/jstl/core .
在JavaEE 5中,包含JSTL 1.1,名称空间为http://java.sun.com/jsp/jstl/core 。 In JaveEE 6 and JavaEE 7, JSTL 1.2 is included, the namespace is http://java.sun.com/jsp/jstl/core .
在JaveEE 6和JavaEE 7中,包括JSTL 1.2,名称空间为http://java.sun.com/jsp/jstl/core 。
But if your web application uses JSF+Facelets, for JSF 1.x+Facelets 1.x in JaveEE 5, the namespace is http://java.sun.com/jstl/core . 但是,如果您的Web应用程序使用JSF + Facelets,则对于JaveEE 5中的JSF 1.x + Facelets 1.x,名称空间为http://java.sun.com/jstl/core 。 For JSF 2.0+Facelets 2.x in JavaEE 6, the namespace is http://java.sun.com/jsp/jstl/core .
对于JavaEE 6中的JSF 2.0 + Facelets 2.x,名称空间为http://java.sun.com/jsp/jstl/core 。 For JSF 2.2+Facelets 2.2 in JavaEE 7, the namespace is http://xmlns.jcp.org/jsp/jstl/core .
对于JavaEE 7中的JSF 2.2 + Facelets 2.2,名称空间为http://xmlns.jcp.org/jsp/jstl/core 。
The Java EE 7 Tutorial briefly states the new URIs for JSTL in the What Is Facelets section as : Java EE 7教程在“ 什么是Facelets”部分中将JSTL的新URI简要说明为:
However, I have yet to find an implementation of the taglibs that use the URI. 但是,我还没有找到使用URI的taglib的实现。 So the URIs (with their recommended namespaces) should be defined as:
因此,URI(及其推荐的命名空间)应定义为:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
And to get rid of the error you need an implementation of the JSTL loaded as a dependency in provided
scope eg 为了摆脱错误,您需要在
provided
范围内将JSTL的实现加载为依赖项,例如
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
The provided
scope prevents it from being included into the WAR file since the one being used by the application server should be used. 所
provided
作用域可防止将它包含在WAR文件中,因为应使用应用程序服务器正在使用的范围。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.