找不到“http://java.sun.com/jsp/jstl/core"的标签库描述符; [英] Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
问题描述
我正在尝试使用 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 库的新版本的评论中提到:JSTL 1.2.1 版 API 和 JSTL 1.2.1 .
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"的标签库描述符;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!