I am currently migrating a Spring MVC Webapp (xml-config to java-config, tomcat to embedded tomcat via spring-boot).
The webapp uses freemarker as templating engine and JSP Taglibs. Now when I call a freemarker page I get the following error:
freemarker.ext.jsp.TaglibFactory$TaglibGettingException:
No TLD was found for the "http://www.springframework.org/tags/form" JSP taglib URI. (TLD-s are searched according the JSP 2.2 specification. In development- and embedded-servlet-container setups you may also need the "MetaInfTldSources" and "ClasspathTlds" freemarker.ext.servlet.FreemarkerServlet init-params or the similar system properites.)
The freemarker-header.ftl begins with following snippet:
<#assign form=JspTaglibs["http://www.springframework.org/tags/form"]>
<#assign core=JspTaglibs["http://java.sun.com/jstl/core"]>
<#assign spring=JspTaglibs["http://www.springframework.org/tags"]>
<#assign osc=JspTaglibs["/WEB-INF/osc.tld"]>
I did not find any usable search results for MetaInfTldSources and ClasspathTlds. Any one solved this problem before?
KR Habib
Spring Boot doesn't support the use of JSP taglibs with Freemarker out of the box. There's an open enhancement request that you might be interested in. It contains a link to a possible workaround where you configure FreemarkerConfigurer
's tag lib factory with some additional TLDs to be loaded from the classpath:
freeMarkerConfigurer.getTaglibFactory().setClasspathTlds(…);