Java EE 7 : Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core”

杀马特。学长 韩版系。学妹 提交于 2019-12-06 16:37:42

If your web application uses JSTL directly, for JSTL 1.0, the namespace is http://java.sun.com/jstl/core. In JavaEE 5, JSTL 1.1 is included, the namespace is 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.

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. For JSF 2.0+Facelets 2.x in JavaEE 6, the namespace is 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.

The Java EE 7 Tutorial briefly states the new URIs for JSTL in the What Is Facelets section as :

However, I have yet to find an implementation of the taglibs that use the URI. So the URIs (with their recommended namespaces) should be defined as:

<%@ 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 e.g.

<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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!