Search code examples
jspweb.xmlcustom-tags

Is it possible to define custom JSP tag without web.xml


I have a Servlet 3.0 project where web.xml does not exist. Just realized web.xml will needed to refer the TLD.

From Oracle custom JSP tag help page:

4 Reference the TLD in the Web application deployment descriptor (web.xml).

Is web.xml the only way to go?


Solution

  • You do not need to reference the TLD in your web.xml file.

    Tag Library Descriptor (TLD) files are discovered automatically in JAR files in WEB-INF/lib and within the WEB-INF directory itself.

    See the JSP specifications for more information.