Editing a Web deployment descriptor file for a custom tag library

The Web deployment descriptor file can contain a <taglib-uri> and a <taglib-location> tag that maps the URI to the actual TLD file. The <taglib-uri> serves as an alias for the TLD file that will be published as WEB-INF/taglib.tld. This allows you to shorten the taglib directive in the JSP file.

  1. Adding the Tag Library Descriptor (TLD) file.

  2. Adding a taglib directive to a JSP file.

  3. Adding a custom tag to a JSP file.

To edit a Web deployment descriptor file:

  1. Expand your Web project in the Enterprise Explorer view of the Web perspective.

  2. Right-click Deployment Descriptor and select Open. The Web Deployment Descriptor editor opens.

  3. Click the tabs in the editor to edit the deployment descriptor. For more information about these tabs refer to Web Deployment Descriptor Editor. Use the Source page to edit the Web Deployment Descriptor source directly.

Below is an example of <taglib-uri> and <taglib-location> tags used in a Web deployment descriptor file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
</web-app>
<display-name>helloWorld-server</display-name>
<taglib>
     <taglib-uri>mytags</taglib-uri>
     <taglib-location>WEB-INF/taglib.tld</taglib-location>
</taglib>
</web-app>

 

Related concepts

The Web Deployment Descriptor editor

Custom tag libraries

 

Related tasks

Adding custom JSP tags

Adding the Tag Library Descriptor (TLD) file

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

 

Related reference

HTML and JSTL tag libraries