Tag Libraries

If the Web application uses one or more tag libraries, you can make sure that the Web container can locate them by specifying a mapping for each tag library in the deployment descriptor. If you selected tag libraries in the JSP Web Target wizard, they display here.

You use a taglib directive to refer to a tag library in a JSP page. For example:

<%@ taglib uri="/WEB-INF/tlds/mycalc.tld" prefix="mc" %>

The uri attribute specifies the uniform resource locator (URI) for the TLD file relative to the root of the Web application. You can map this path to a short name in the deployment descriptor. Specify the name you want to use in the Tag Library URI column, and the location relative to the root of the Web application in the Descriptor File Location column. The value of the location must have a leading forward slash ( / ). For example, /WEB-INF/tlds/Testlibrary_1_3.tld.

If you specify /mycalc as the short name for the /WEB-INF/tlds/mycalc.tld, the taglib directive can be written like this:

<%@ taglib uri="/mycalc" prefix="mc" %>