Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
 
 
Search All Tutorials

 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 
JSP
  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. 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.

                         

Facing Programming Problem?
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

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

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.

Hot Web Programming Job

Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

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

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

Copyright © 2007. All rights reserved.