[opencms-dev] modules

Christoph Schönfeld cschoenfeld at sylphen.com
Fri Nov 3 10:24:02 CET 2006


Hi Felix,

1. As far as I know, you have to publish your module. During publishing, 
the class files, classpath resources and libraries of your module will 
be copied into WEB-INF/classes respectively WEB-INF/lib.

2. You should reference your taglib by its URL and define a taglib 
mapping from the URL to your TLD file within web.xml such as the 
existing mapping in place for the OpenCms taglib.

However, there is an approach much more elegant and less intrusive: You 
don't have to change web.xml and not even place your TLD into the 
OpenCms context by hand. Just put it into the META-INF/ folder within 
the JAR file of your taglib and deploy it along with the module. (You 
still need to publish it, though, and reload the webapp for every change.)

The servlet container is bound to search for taglib descriptors during 
deployment of any JAR file within WEB-INF/lib. From the JSP 1.2 
Specification:

JSP.7.3.1 Identifying Tag Library Descriptors
Tag library descriptor files have names that use the extension “.tld”, 
and the
extension indicates a tag library descriptor file. When deployed inside 
a JAR file,
the tag library descriptor files must be in the META-INF directory, or a
subdirectory of it. When deployed directly into a web application, the 
tag library
descriptor files must always be in the WEB-INF directory, or some 
subdirectory
of it.
The DTD for a TLD document is "http://java.sun.com/dtd/webjsptaglibrary_
1_2.dtd"

The JSP 2.0 Specification adds:
TLD files should not be placed in /WEB-INF/classes or /WEB-INF/lib.
The XML Schema for a TLD document is http://java.sun.com/xml/ns/j2ee/
web-jsptaglibrary_2_0.xsd. See Section JSP.C.1, “XML Schema for TLD, JSP
2.0”.

Best regards,
Christoph



More information about the opencms-dev mailing list