There are basically two ways the files that make up a tag library (the TLD and all the class files) can be made available to a container: packaged in a JAR file or kept as regular files in the filesystem. On top of this, there are three ways to identify the tag library you use in a JSP page. Let’s look at the two topics one at a time.
During development, you
may want to let the tag library classes
and the TLD file reside as-is in the filesystem, since it makes it
easy to change the TLD and modify and recompile the classes. Just
make sure the class files are stored in a directory
that’s part of the classpath for the JSP container,
such as the
WEB-INF/classes directory for the
web application. The TLD must be also available as a file with a
.tld extension in a directory where the JSP
container can find it. The recommended location is the
When you’re done with the development, you may want
to package all tag-handler classes and the TLD in a JAR file. This
makes it easier to install the library in an application. In this
case, the TLD must be placed as a file with a .tld extension in the
META-INF directory in the JAR file, for instance
To create the JAR file, first arrange the files in a directory with a structure like this:
META-INF/ taglib.tld com/ ora/ jsp/ tags/ ForwardTag.class ... util/ StringFormat.class ...
The structure for the class ...