java 使用java配置找不到“http://www.springframework.org/tags/form”的标签库描述符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44965939/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 08:25:49  来源:igfitidea点击:

Can not find the tag library descriptor for "http://www.springframework.org/tags/form" with java configuration

javajspspring-mvctaglibapache-tiles

提问by O?uzhan Aygün

I am currently learning spring mvc and made an example "my app" which includes spring mvc and apache tiles. Everything works fine but in jsp i get this following error:

我目前正在学习 spring mvc 并制作了一个示例“我的应用程序”,其中包括 spring mvc 和 apache 磁贴。一切正常,但在 jsp 中我收到以下错误:

Can not find the tag library descriptor for "http://www.springframework.org/tags/form"

找不到“ http://www.springframework.org/tags/form”的标签库描述符

here is my mainLayout.jsp

这是我的 mainLayout.jsp

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <%@ page isELIgnored="false" %>
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>

    <html>

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title><tiles:getAsString name="title" /></title>
        <link href="<c:url value='/static/css/bootstrap.css' />"  rel="stylesheet"></link>
        <link href="<c:url value='/static/css/app.css' />" rel="stylesheet"></link>
    </head>

    <body>
            <header id="header">
                <tiles:insertAttribute name="header" />
            </header>


            <section id="site-content">
                <tiles:insertAttribute name="body" />
            </section>

            <footer id="footer">
                <tiles:insertAttribute name="footer" />
            </footer>
    </body>
    </html>

before you ask, I have included all the spring ,tiles and jstl dependency in my pom. only the form tag gives error.

在你问之前,我已经在我的 pom.xml 文件中包含了所有的 spring、tiles 和 jstl 依赖项。只有表单标签会出错。

采纳答案by Rahul khanvani

It seems that your tag library is missing form the class-path As You don't have to configure anything. Since JSP 2.0 taglibs can be discovered automatically.

类路径中似乎缺少您的标记库,因为您无需配置任何内容。由于可以自动发现 JSP 2.0 标记库。

All You need to do is place them in WEB-INF or it's sub-folders. If you are packaging Your TLDs as JAR files, place them in WEB-INF/lib or META-INF of the JAR

您需要做的就是将它们放在 WEB-INF 或其子文件夹中。如果您将 TLD 打包为 JAR 文件,请将它们放在 JAR 的 WEB-INF/lib 或 META-INF 中