Adding the Tag Library Descriptor (TLD) file

In order to implement custom JSP tags, add the Tag Library Descriptor (TLD) file (taglib.tld) to your project.

To add the taglib.tld file to your project, complete the following steps:

  1. Add the independent tag library descriptor, taglib.tld to your WEB-INF folder:

    1. In the Enterprise Explorer view of the Web perspective, select the

      WebContent/WEB-INF folder in your Web project.

    2. Right-click the

      WEB-INF folder and select

      Import. The Import wizard opens.

    3. Click

      General | File System Then click Next.

    4. In the File System page of the Import wizard, click Browse to select the directory from which you want to import your independent tag library descriptor, taglib.tld.

    5. Select the tid file from the tree viewer on the wizard

    6. Click Finish to add your independent tag library to your WEB-INF folder.

  2. Add the custom tag library to the Web project:

    1. In the Enterprise Explorer view of the Web perspective, right-click the Web project and select

      Import. The Import wizard opens.

    2. Click

      File System | Next.

    3. In the File System page of the Import wizard, click Browse to select the directory from which you want to import your custom tag library.

    4. Select the tid file from the tree view on the wizard

    5. Click Finish to add your custom tag library to your Web project.

    Tip:

    • If a TLD file is packaged in a JAR file, you can also import the TLD from the

      Insert Custom Tag dialog box, available by selecting

      JSP

      Insert Custom from the main menu.

    • You can also create the tag library descriptor file when you create your Dynamic Web project. On the Project Facets page of the New Web Project wizard, select the

      Struts check box. The wizard automatically adds the tag library descriptor (TLD) file to your dynamic Web project.

Now that you have added the TLD file to your project, you can add a taglib directive to your JSP file.

 

Related concepts

Custom tag libraries

 

Related tasks

Adding custom JSP tags

Adding a taglib directive to a JSP file

Specifying the taglib directive

Adding a custom tag to a JSP file

Editing the properties of a custom tag

Editing a Web deployment descriptor file for a custom tag library

 

Related reference

HTML and JSTL tag libraries