JSP Projects

JSP Project

What is Tag Lib directive?
Previous Home Next


Tag Lib is the collection of custom tag .To customize action from tag file programmer can use tag lib. 

Tag lib is used in JSP code to improve the reuse ability  of the JSP code in JSP application. .

JSP Taglib directive:

The JSP taglib directive is used to define a tag library that defines many tags. We use the TLD (Tag Library Descriptor) file to define the tags. In the custom tag section we will use this tag so it will be better to learn it in custom tag.

Syntax JSP Taglib directive:

<%@ taglib uri="uriofthetaglibrary" prefix="prefixoftaglibrary" %>

Example: JSP Taglib directive

In this example, we are using our tag named currentDate. To use this tag we must specify the taglib directive so the container may get information about the tag.



<%@ taglib uri="http://www.ycd.com/tags" prefix="mytag" %>




 Declaration of tag lib
&lt;%@ taglib uri = "tag library URI" prefix = "tag Prefix" %&gt;
In above syntax taglib uri are both keywords.uri identifies the tag lib descriptor and is enclosed in " " .prefix included inside " " is a string that will become the prefix to distinguish a custom action.


Previous Home Next