| [ directory ] |
A Tag Library is a collection of custom tags typically designed to complement each other and accomplish a common goal. The Tags within the library are written either in Java or as JSP fragments and can be used by a JSP as described by a Tag Library Descriptor (TLD) file. Most sets of custom tags come packaged as one JAR file which can be easily deployed with any Web Application.
An easy way to think of a custom tag is as an abstracted scriptlet. Similar to a scriptlet, the tag consists of code completely authored by a JSP developer or development tool. However, unlike a scriptlet the code itself is not present directly on the JSP. Instead of directly embedding code within a JSP, the code is abstractly bound to the JSP by means of a TLD. Figure 7-1 illustrates the concept.

Notice in Figure 7-1 that the abstracted code is referred to as either a "tag handler" or a "tag file". Both tag files and tag handler classes can be used to power a custom tag. Tag files are covered later in the chapter but function as easy ways to make tag handlers. Tag handlers are the official name for the Java class that encapsulates the code that makes a custom tag work.
Tag handlers, tag library descriptors, and the markup involved in using them are the focus of this chapter. The topics nicely fill a chapter and comprise everything you need to start building JSP custom tags.
| [ directory ] |