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.
Prerequisites:
- Adding the Tag Library Descriptor (TLD) file.
- Adding a taglib directive to a JSP file.
- Adding a custom tag to a JSP file.
To edit a Web deployment descriptor file:
- Expand your Web project in the Project Explorer view of the Web perspective.
- Right-click Web Deployment Descriptor and select Open. The Web Deployment Descriptor editor opens.
- Click the tabs in the editor to edit the deployment descriptor. You can edit the following pages in the editor:
- Overview
- Servlets and JSPs
- Filters
- Listeners
- Security
- Environment Variables
- References
- Pages
- Context Parameters
- MIME Mappings
- WebSphere Extensions
- Source
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
Web deployment descriptor
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
Tag libraries