Tag libraries are declared by using the <%@taglib %> directive of the JSP. This tag has some own attributes and it's values are specified attributes specifically of the taglib directive. Attributes of the taglib directive are as follows:
Using all the attributes we declare the tag libraries through the <%@taglib %> directive like the following line i.e. used in the your JSP code for reuse in the JSP application. All the reusable codes are written in the specific file which must have the ".tld" or the ".tag" extension. These files are stored in the WEB-INF folder inside your JSP application directory whether in the tld folder or the tags folder. You can put all the tag files (which has the ".tag" extension) in the tags folder and all the TLD (Tag Library Descriptor) files can be put in the tld folder inside the WEB-INF folder in your JSP application directory.
If you declare the tag library through the taglib directive by using the absolute path URIs then you mention the taglib directive like the following line of the code that has to be written in the JSP application code:
<%@ taglib prifix="c" uri="http://java.sun.com/jsp/jstl/core" %>
And if you declare the tag library through the taglib directive by using the relative path of your customized tag file or TLD files then you have to mention the taglib directive like the following line of the code that has to be written in the JSP application code:
<%@taglib prifix="tagLibraryName" tagdir="/WEB-INF/AnyTagDirectory/tagFileName.tag" %>
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: March 13, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles