2017-07-07 190 views
0

我目前正在學習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

您應該在您的問題中明確描述該約束。 –

回答

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 –

相關問題