问题描述
我正在尝试使用JSTL,但是我收到以下错误:
I'm trying to use JSTL, but I get the following error:
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?
推荐答案
在JSP中使用taglib定义,或者最好在第一行的每个页面中包含它。
Use taglib definition in your JSP or better include it in every page by the first line.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
此外还修复了 jstl-1.2
依赖关系你的项目。还要在 web.xml
中使用至少2.4的servlet规范。
There's also fix jstl-1.2
dependency in your project. Also use servlet specification at least 2.4 in your web.xml
.
maven依赖项是(maven是一个开源开发工具)
The maven dependencies are (maven is a open source development tool)
<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>
在 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">
编辑:
我想添加一条注释,@ informatik01在评论中提到了Maven存储库提供的更新版本的JSTL库:和。
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 .
这篇关于找不到“http://java.sun.com/jsp/jstl/core"的标记库描述符;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!