Things You'll Need:
- Java Integrated Development Environment (IDE)
-
Step 1
Open your Java Integrated Development Environment (IDE) and create a new "Tag Library Descriptor" (TLD) file. A TLD file is an XML document that is used to create the custom tag and associated information for the tag.
-
Step 2
Create the "taglib" header tag that contains information such as the version number of the tag, JSP version being used, short name of the tag, and additional information for the tag library.
-
Step 3
Add the custom tag after the header information in the TLD file. The name of the tag will be the element value for the <name> tag.
-
Step 4
Choose the Class to use for the custom tag in the subsequent <tagclass> element. The fully qualified package naming convention must be used for the Class name if you are using the Java package convention. An example of this convention would be: "com.demandmedia.JSPTagExample.
-
Step 5
Include desired JSP tag body information after the Class declaration. No body information is required, however, you can include meta information such as a message or version in the body. An example of a body declaration is:
<info>
My First JSP Custom Tag
</info. -
Step 6
Save the TLD file after you have filled in the body information and your first JSP custom tag is complete.







