javajspspring-mvctaglibapache-tiles

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


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:

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

here is my 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.


Solution

  • 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.

    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