Create Tag Library Descriptor (TLD) File

In this example, we learn how to create library descriptor file in your project. Developers can group together tags of similar or related functionality. For this, a tag library descriptor file (TLD file) is used to describe the tag extensions and relate them to their java classes. TLD files are written in XML notation. Follow these steps to create the file:

1. Go to project option and right click on your project and select new -> Other in the project window, as shown in figure.



2. Select Web under Categories, and select Tag Library Descriptor under File Types, as shown in figure. Click Next.

3. New Tag Library Descriptor dialog appears next. Enter TLD Name as image, as shown in Figure and click Finish.

4. Now, image.tld file is added in the project window under WEB-INF / tlds. The source code given below:


image.tld


http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">
1.0
<short-name>imageshort-name>
/WEB-INF/tlds/image



Source Code of image.tld

0 comments:

Post a Comment