taglib

The taglib Directive |

This directive allows the page to use custom user defined tags. It also names the tag library (a compressed file) that they are defined in. The engine uses this tag library to find out what to do when it comes across the custom tags in the JSP. The tag library concept was recognized to be very powerful, however in the JSP 1.0 version of the specification the implementation mechanism to enable tag libraries was not clearly defined.

The JSP 1.1 specification is actually a lot clearer on tag libraries and their usage.

        <%@ taglib uri="tagLibraryURI" prefix="tagPrefix" %>

Example

       <%@ taglib  uri="http://www.myserver.com/mytags" prefix="sameer" />

uri |
Default: No value causes compilation error. |
A URI (Uniform Resource Identifier) that identified the tag library descriptor. A tag library descriptor is used to uniquely name the set of custom tags and tells the container what to do with the specified tags.

tagPrefix |
Default: No value causes compilation error. |
Defines the prefix string in <prefix>:<tagname> that is used to define the custom tag. Note: The prefixes jsp, jspx, java, javax, servlet, sun, and sunw are reserved. For example if this value is "mytag" then when the container comes across any element that starts like <mytag:tagname ... /> in the JSP, it references the tag library descriptor specified in the URI.