In the old way, we put custom taglib description file at WEB-INF/xxx.tld, and JSP files load this file with
When we use Spring boot and config the application completely with java code (no web.xml, xxx-servlet.xml etc.), where to put it?
under resources/WEB-INF? or resources/META-INF?
解决方案
Just drop your tld in /src/main/webapp/WEB-INF/ and reference it from your jsp using the uri.
Example of tld located in /src/main/webapp/WEB-INF/
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
Example Tag Library
4.0
example
http://www.example.org/tags
exampleTag
com.example.taglib.ExampleTag
empty
Example of referencing your tag library from a JSP file:
And of course, using your custom tags:
Hope it helps!