Home Tutorial Jsp JSPs : taglib Directives

 
 

Share on Google+Share on Google+
JSPs : taglib Directives
Posted on: December 1, 2012 at 12:00 AM
Advertisement
In this section we are going to discuss the taglib directives which is one part of Directives.

JSPs : taglib Directives

In this section we are going to discuss the taglib directives which is one part of Directives.

taglib Directives :

Taglib directive is one of directive of JSP pages. It defines the tag library which is collection of tags. There is standard as well as custom tag libraries. Standard tag libraries are pre-defined libraries and the custom tag libraries are the user defined libraries.

It has two important attribute which is needed at the time of writing taglib description.

  • uri : Locates the TLD file of a custom tag.
  • prefix : Defines a prefix string to be used for distinguishing a custom tag instance.

Syntax:

<%@ taglib uri="uri" prefix="prefixOfTag" >

Example : In this example we are using taglib directive and print the variable content.

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>taglib Example.</title>
</head>
<body>
<font color="blue" size="5"> 
<c:set var="name" value="This is taglib Example."></c:set>
<c:out value="${name}"></c:out>
</font>
</body>
</html>

Output :

Advertisement

Related Tags for JSPs : taglib Directives :


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: December 1, 2012

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com