Deploying the Custom Tag Library
You can deploy the custom tag library
two different ways: you can deploy
it as separate files in the web application structure, or package all
files in a JAR file and deploy the JAR file. During development,
it’s often convenient to deploy the files
separately, because it makes it easier to replace updated class files
or the TLD. Just place the TLD somewhere under the
application’s WEB-INF
directory, for example, in a subdirectory named
WEB-INF/tlds. Put the tag handler class files
under WEB-INF/classes using a directory
structure that matches the package structure, such as
WEB-INF/classes/com/mycompany/jsf/taglib for the
ValidateLaterThanTag
in Example 7-7.
For production deployment, it’s better to package all tag library files in a JAR file. The TLD goes in the JAR file’s META-INF directory, and the class files in a directory structure mirroring the package structure: for example, META-INF/taglib.tld and com/mycompany/jsf/taglib/ValidateLaterThanTag.class for the example tag library. To deploy the library, put the JAR file in the application’s WEB-INF/lib directory.
Get JavaServer Faces now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.