First, the basic concept:
1. Tags (tag):
A label is an XML element that enables a JSP Web page to be concise and maintainable, and to easily implement the same JSP file to support multiple language versions. Because the label is an XML element, its name and attributes are case-sensitive
2. Tag libraries (Tag library):
A set of functionally similar, logically interrelated tags is called a tag library.
3. Tag library description file (Tag descriptor):
The tag library description file is an XML file that provides a mapping of the label references in the class and JSP in the tag library. It is a configuration file, and Web.xml is similar.
4. Label processing class (Tag Handle Class):
The label processing class is a Java class that inherits the TagSupport or extends the Simpletag interface, which enables you to implement the specific functions of a custom JSP tag
Second, the custom JSP label format:
1.
<% @ taglib prefix=”someprefix” uri=”/sometaglib” %>
For the JSP container to be able to use custom behavior in the tag library, the following two conditions must be met:
1 Identify the label representing this custom behavior from a specified tag library
2 Find specific classes to implement these custom behaviors
The first requirement-find a custom behavior that belongs to that tag library-is done by the prefix of the label directive (Taglib directive ' s Prefix), so elements that use the same prefix on the same page belong to this tag library. Each tag library defines a default prefix that is used in a document in a tag library or in a page to insert a custom label. So, you can use prefixes other than those such as JSP,JSPX,JAVA,SERVLET,SUN,SUNW (which are all reserved words specified in the JSP white paper).
The URI attribute satisfies the second requirement above. Find the corresponding class for each custom behavior. This URI contains a string that the container uses to locate the TLD file. The name of all label processing classes in the tag library can be found in the TLD file