[ Team LiB ] Previous Section Next Section

Creating Tag Libraries Best Practices

Use abstract classes rather than interfaces to implement your tags. This strategy facilitates, standardizes, and effectively manages your tag library development.

To ease pending deployments, package your tag libraries and supporting files into JAR files. If you're using tag libraries within deployed libraries, you can never be sure as to the state of your classpath; that is, what files you're actually referencing in support of your tag library. Packaging and then referencing the tag library JAR file validates completeness of the deliverable.

To facilitate version control and file management, package related tag libraries within a common JAR file. Also establish a naming convention for your tag library JAR and the uri attribute used to reference the tag library JAR file within the web.xml file.

Try to separate tags in two distinct categories: the generic tags that serve as visual components (view) and the application-specific tags that perform the processing (controller). That way the visual components will be useable in other projects.


There are two tag libraries created for use with the Global Auctions application: summaryDisplayItem and displayItem. Both were previously presented in examples for simple and body tags.

    [ Team LiB ] Previous Section Next Section