Javaserver Pages





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
JSP Tutorial
Introduction Introduction
Installing JDK-Windows Installing JDK-Windows
Installing JDK-Linux Installing JDK-Linux
Installing Tomcat Installing Tomcat
Simple Program in JSP Simple Program in JSP
Pre-defined Variables Pre-defined Variables
Syntax of Tags Syntax of Tags
JSP Expression Language JSP Expression Language
JSP EL Operators JSP EL Operators
EL Implicit Variables EL Implicit Variables
Scopes Scopes
Using Arrays Using Arrays
Methods Methods
JSP Elements JSP Elements
Including Beans Including Beans
JSTL Tags JSTL Tags
Custom Tags Custom Tags
Session Session in JSP
Handling Cookies Handling Cookies
JSP Application Structure JSP Application Structure
Configuring web.xml Configuring web.xml
Tomcat Configuration Tomcat Configuration
JSP Examples JSP Examples
Forums Ask Your Doubts
Feedback Feedback
 




Taglib Directive in JSP


Tutorials Jsp

Topic

How is Taglib Directive used in JSP?



Explanation

Taglib directive is used to define the tag library which is a collection of tags. A Tag library can be a standard(pre-defined) or a custom(user-defined) one. The "prefix" attribute is a must for custom as well as standard tags in jsp.

Syntax:
   <%@ taglib uri="URIToTagLibrary" prefix="tagPrefix" %>
Example:
   <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
   <p>Simple Example for C:out</p>
     Multiply 5 and 2::<c:out value="${5*2}" />
Result:
    Simple Example for C:out
    Multiply 5 and 2::10 

In the above example the "taglib" directive points to the core tag library of JSTL or JSP Standard tag library using the "uri" attribute "http://java.sun.com/jsp/jstl/core", the prefix used in the taglib directive will be "c" for core tag library. If a custom tag library is used then the prefix can be chosen by the user.






A Note
JSP(Java Server Pages) is one of the most used Server Side Programming Language in the world. Simple introduction, basic program codes with examples. Begin coding your own JSP scripts with this online tutorial. Hope you enjoy this tutorial. Do send your feedback or suggestions on this JavaServer Pages tutorial. This is a copyright content.


Other Links

web hosting