1

当我尝试访问配置的索引页时出现以下错误:

/WEB-INF/JSP/index.jspx (line: 6, column: 67) Could not add one or more tag libraries

这是我的 web.xml 的一部分

//...
<jsp-config>
    <taglib>
        <taglib-uri>http://www.myurl.com/url/url.tld</taglib-uri>
        <taglib-location>/WEB-INF/tld/url.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
        <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
    </taglib>
</jsp-config>
</web-app>

这是 index.jspx

<?xml version="1.0" encoding="utf-8"?>

<jsp:root   xmlns:c="http://java.sun.com/jsp/jstl/core"
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
        xmlns:url="http://www.myurl.com/url/url.tld">

<jsp:directive.page contentType="text/html" pageEncoding="UTF-8" />
<jsp:output omit-xml-declaration="true" />
<jsp:output doctype-root-element="HTML"
            doctype-system="about:legacy-compat" />

<html lang="en">
<head>
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/resources/Images/favicon.ico"/>
    <link rel="stylesheet" type="text/css" media="screen" href="${pageContext.request.contextPath}/resources/CSS/main.css"/>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>url</title>

</head>
<body>
    <url:header>test</url:header>
    <c:out value="Feuer"></c:out>
</body>
</html>

</jsp:root>

网址.tld

<?xml version="1.0" encoding="utf-8"?>

<taglib 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-jsptaglibrary_2_1.xsd"
    version="2.1">

<display-name>myurl - tag library</display-name>
<tlib-version>1.0</tlib-version>
<short-name>url-core</short-name>
<uri>http://www.myurl.com/url/url.tld</uri>

<tag-file>
    <name>header</name>
    <path>/WEB-INF/tag/common/header.tagx</path>
</tag-file>


</taglib>

标头.tagx

<?xml version="1.0" encoding="utf-8"?>

<jsp:root xmlns="http://www.w3.org/1999/xhtml"
      xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

<header>
    <c:out value="FEUER"></c:out>
</header>


</jsp:root>

我想不通是什么问题。。

如果我不插入“url”标签库并且不在“body”内使用它,我不会收到错误消息。

有人对这个问题有经验吗?我的 tld 有问题吗?

提前致谢

4

0 回答 0