[英]Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core”
I'm trying to use JSTL, but I get the following error:我正在尝试使用 JSTL,但出现以下错误:
Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
How is this caused and how can I solve it?这是怎么引起的,我该如何解决?
Use taglib definition in your JSP or better include it in every page by the first line.在您的 JSP 中使用 taglib 定义,或者更好地将它包含在每个页面的第一行。
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
There's also fix jstl-1.2
dependency in your project.在您的项目中还修复了jstl-1.2
依赖项。 Also use servlet specification at least 2.4 in your web.xml
.还要在web.xml
使用至少 2.4 的 servlet 规范。
The maven dependencies are (maven is a open source development tool) maven依赖是(maven是一个开源开发工具)
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>compile</scope>
</dependency>
In the web.xml
start writing在web.xml
开始写
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
EDIT:编辑:
I'd like to add a note that @informatik01 has mentioned in the comment about newer version of JSTL libraries available from Maven repository: JSTL version 1.2.1 API and JSTL 1.2.1 .我想添加一个注释,@informatik01 在关于 Maven 存储库中可用的 JSTL 库的较新版本的评论中提到: JSTL version 1.2.1 API和JSTL 1.2.1 。
I had the same problem even after I added jar files for jstl and standard.即使在为 jstl 和标准添加了 jar 文件后,我也遇到了同样的问题。 For me, it resolved after I added a Targeted runtime for my project.对我来说,它在我为我的项目添加目标运行时后解决了。
Go to Project Properties > Targeted Runtimes and select the server you are using (Tomcat 7.0 for me).转到 Project Properties > Targeted Runtimes 并选择您正在使用的服务器(对我来说是 Tomcat 7.0)。
create a libs folder in the inside WEB-INF directory and add jstl, standard jars as below.在WEB-INF目录下创建libs文件夹,添加jstl,标准jar包如下。
You may try to make the folder which include jsp-s become the source folder of eclipse, that solved the same problem of mine.您可以尝试将包含jsp-s的文件夹变成eclipse的源文件夹,解决了我的同样问题。 As below:如下:
- open project's properties.(right click project, then choose the Properties)打开项目的属性。(右键单击项目,然后选择属性)
- choose Java Build Path, select the Source tab, click Add Folder and choose the folder including your jsp-s, OK选择 Java Build Path,选择 Source 选项卡,单击 Add Folder 并选择包含您的 jsp-s 的文件夹,OK
您只需要在项目构建路径中包含standard.jar
文件。
in your pom.xml just add在你的 pom.xml 中添加
<!-- jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
and try run并尝试运行
mvn eclipse:eclipse -Dwtpversion=2.0
will solve the problem将解决问题
I have similar issue, why should we add external jar files when we are using maven?我有类似的问题,为什么我们在使用 maven 时要添加外部 jar 文件?
I have already included jstl maven dependency then also I encounter error "Can not find the tag library descriptor for " http://java.sun.com/jsp/jstl/core "".我已经包含了 jstl maven 依赖项,然后我也遇到错误“找不到“ http://java.sun.com/jsp/jstl/core ”的标签库描述符。 Then I include following dependency then error get solve, without including any single external jar file.然后我包含以下依赖项,然后错误得到解决,不包含任何单个外部 jar 文件。
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.