Home Jsp Declaring Tag Libraries In JSP

Related Tutorials


 
 

Share on Google+Share on Google+

Declaring Tag Libraries In JSP

Advertisement
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.

Declaring Tag Libraries In JSP

     

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:

  • uri
  • prifix
  • tagdir

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" %>

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 13, 2008

Related Tutorials

Discuss: Declaring Tag Libraries In JSP  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com