Home Jsf Netbeans Create Tag Library Descriptor (TLD) File

Related Tutorials


 
 

Share on Google+Share on Google+

Create Tag Library Descriptor (TLD) File

Advertisement
In this example, we learn how to create library descriptor file in your project.

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

<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.0" xmlns="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">
  <tlib-version>1.0</tlib-version>
  <short-name>image</short-name>
  <uri>/WEB-INF/tlds/image</uri>
  <!-- A validator verifies that the tags are used correctly at JSP
 translation time. Validator entries look like this
  <validator>
  <validator-class>com.mycompany.TagLibValidator</validator-class>
  <init-param>
 <param-name>parameter</param-name>
 <param-value>value</param-value>
  </init-param>
  </validator>
 -->
  <!-- A tag library can register Servlet Context event listeners in
  case it needs to react to such events. Listener entries look
  like this
 <listener>
 <listener-class>com.mycompany.TagLibListener</listener-class
 </listener>
 -->
</taglib>


Source Code of image.tld

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 7, 2008

Related Tutorials

Discuss: Create Tag Library Descriptor (TLD) File   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:2
jailall
November 24, 2011
Tag Library Descriptor Problem

Im using Netbeans ver. 7.0.1 but im having a problem creating tag library descriptors for my enterprise application. The error says "File name not valid" in the WEB-INF folder.
Arunava Chatterjee
July 11, 2013
About TLD Creation

Show the creation of TLD file with its implementation in struts2 framework which can handle database.It is good but I need better. Waiting for reply from your side.
DMCA.com