![]() |
![]() |
||||
At line 1 removed 1 line. |
!!!<taglib> |
At line 3 removed 42 lines. |
This parent element specifies the <[taglib-uri|web.xml.TagLibUri]> and <[taglib-location|web.xml.TagLibLocation]> for a JSP Custom Tag Library. |
It is used inside the <jsp-config> section in [web.xml], and is required when using TLD (Tag Library Definition) files in Servlets 2.3 and earlier. |
!Example 1 |
{{{ |
<jsp-config> |
<taglib> |
<taglib-uri>mytags</taglib-uri> |
<taglib-location>/WEB-INF/jsp/mytaglib.tld</taglib-location> |
</taglib> |
</jsp-config> |
}}} |
Declare this in your JSP file using: |
{{{ |
<%@ taglib prefix="mytags" uri="mytags" %> |
<mytags:sometag>Test</mytags:sometag> |
<mytags:othertag /> |
}}} |
!Example 2 |
{{{ |
<jsp-config> |
<taglib> |
<taglib-uri>http://metawerx.net/mapp/taglibs</taglib-uri> |
<taglib-location>/WEB-INF/mapp.tld</taglib-location> |
</taglib> |
</jsp-config> |
}}} |
This taglib can be used in your JSP file as follows: |
{{{ |
<%@ taglib prefix="mapp" uri="http://metawerx.net/mapp/taglibs" %> |
<mapp:sometag>Test</mapp:sometag> |
<mapp:othertag /> |
}}} |
!Parent-element: |
* <[jsp-config|web.xml.JspConfig]> |
!See Also |
* [Removing taglib from web.xml] - The <taglib> section is no longer required in [web.xml] since JSP 2.0 / Servlets 2.4. |
* [TLD Files - DTD and XSD] - JSP 2.0 uses XSD declarations, see examples here for TLD files |