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

问题描述:

我目前正在学习spring mvc,并做了一个包含spring mvc和apache tile的“我的应用程序”示例。一切工作正常,但在JSP中我得到这个以下错误:使用java配置找不到“http://www.springframework.org/tags/form”的标记库描述符

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

这里是我的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> 

你提问之前,我有包括我所有的春天,瓦片和jstl依赖。 只有表单标签给出错误。

+0

yes我看到了这个问题,但解决方案对我无效,因为我没有使用网络。 xml使用java配置。 –

+0

您应该在您的问题中明确描述该约束。 –

看起来你的标签库缺少类路径 因为你不必配置任何东西。由于JSP 2.0 taglib可以被自动发现。

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

+0

谢谢你的回答。但我使用图书馆的maven,我不知道如何将它们放在WEB-INF或其子文件夹中。 –

+0

必须在您的项目中自动创建一个WEB-INF文件夹 –

+0

尝试包括此自由并转至project-> run-> Maven Install –