Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
What is a Tag Library in JSP 
 

This section provides you the detailed explanation of the Tag Library in JSP. In the Java Server Pages Technology, multiple actions are accessed by using the tags of the JSP whether the tag is standard tag of the JSP or the custom tag that is made by you.

 

What is a Tag Library in JSP

                         

This section provides you the detailed explanation of the Tag Library in JSP. In the Java Server Pages Technology, multiple actions are accessed by using the tags of the JSP whether the tag is standard tag of the JSP or the custom tag that is made by you. Actions in JSP are created for using programming language objects and gives output as you wish. However, you can say that the tag library is a collection of custom tags.

The Tag Library is used in your JSP code for improving the reusability of the JSP code in your JSP application.

Declaring a Tag Library in JSP code:

Tag libraries are declared by using the <%@taglib %> directive of the JSP. This tag has some own attributes and it's values are specified according to the different attributes of the taglib directive. Attributes of the taglib directive are as follows:

  • uri
  • prifix
  • tagdir

uri: This is the attribute of the taglib directive in JSP that contains the absolute and relative URIs for the TLD (Tag Library Descriptor) file which is with the ".tld" extension. This attribute must have the value as Tag Library Descriptor (TLD).

Some absolute URIs are given for the JSTL library are as follows:

  • For core: http://java.sun.com/jsp/jstl/core
  • For XML: http://java.sun.com/jsp/jstl/xml
  • For Internationalization(date format & currency format): http://java.sun.com/jsp/jstl/fmt
  • For SQL: http://java.sun.com/jsp/jstl/sql

  • For Functions: http://java.sun.com/jsp/jstl/functions

The value of the uri attribute may be absolute or relative if you want to use the taglib directive by specifying the absolute path of the TLD file because uri must have the value as the TLD file. This file must have the extension (".tld"). For example, the declaration of the taglib directive for the core is like <%@taglib prifix="c" uri="http://java.sun.com/jsp/jstl/core" %> otherwise if you want to use the uri attribute of the taglib directive in JSP by specifying the relative URIs then the declaration is like <%@taglib prifix="nameWhatever" uri="/WEB-INF/tldDirectory/tldName.tld" %>.

prifix: This is the attribute of the taglib directive in JSP that is used for naming for the identification of the tag. You can say simply that this attribute of the taglib directive contains the name of the specified Tags or the TLDs for using in your JSP code easily and in efficient manner.

tagdir: This is also a type of the taglib directive in JSP that is used for specifying your customized tags. These customized tags are made by specifying all the action in a file that must have the ".tag" or the ".tld" extension. This is the used in the place of the uri attribute of the taglib directive of JSP. You can use either the uri or the tagdir attribute of the taglib directive in JSP. When you use the tagdir attribute for specifying the tag file then you have to put the tag file in the subdirectory inside the WEB-INF folder in your JSP application directory.

JSP Standard Tag Libray (JSTL) and JSP Custom Tag Libray are two standard of tag library which are almost used for implementing the tag library.

                         

» View all related tutorials
Related Tags: c io sed page tag if for example to exam ci e use in m ad age xa xamp s

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

3 comments so far (
post your own) View All Comments Latest 10 Comments:

This site is really supurb.very helpful for freshers. thanks to roseindia.net

Posted by Viswa on Thursday, 12.6.07 @ 17:38pm | #41445

This site is very helpful to the freshers.The simplicity of the presentation make it more user friendly.Thanks,thanks a lot........

Posted by Rajagiri on Thursday, 08.9.07 @ 15:38pm | #23016

Really nice tutorial for the beginners

Posted by swrana on Thursday, 05.17.07 @ 13:20pm | #16239

Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.