Tag files placed in a subdirectory of /WEB-INF/tags/ do not require a TLD file and don’t have to be packaged. Thus, to create reusable JSP code, you simply create a new tag file and place the code inside it.
The web container generates an implicit tag library for each directory under and including /WEB-INF/tags/. There are no special relationships between subdirectories; they are allowed simply for organizational purposes. For example, the following web application contains three tag libraries:
/WEB-INF/tags/ /WEB-INF/tags/a.tag /WEB-INF/tags/b.tag /WEB-INF/tags/foo/ /WEB-INF/tags/foo/c.tag /WEB-INF/tags/bar/baz/ /WEB-INF/tags/bar/baz/d.tag
tlib-version for the tag library. Defaults to 1.0.
short-name is derived from the directory name. If the directory is /WEB-INF/tags/, the short name is simply tags. Otherwise, the full directory path (relative to the web application) is taken, minus the /WEB-INF/tags/ prefix. Then all / characters are replaced with - (hyphen), which yields the short name. Note that short names are not guaranteed to be unique.
A tag-file element is considered to exist for each tag file, with the following subelements:
The name for each is the filename of the tag file, without the .tag extension.
The path for each is the path of the tag file, relative to the root of the web application.
So, for the example, the implicit TLD for the /WEB-INF/tags/bar/baz/ directory would be as follows:
<taglib> <tlib-version>1.0</tlib-version> <short-name>bar-baz</short-name> <tag-file> <name>d</name> <path>/WEB-INF/tags/bar/baz/d.tag</path> </tag-file> </taglib>
Despite the existence of an implicit tag library, a TLD in the web application can still create additional tags from the same tag files. To accomplish this, you add a tag-file element with a path that points to the tag file.