Jstl(JSP Standard Tag Library):

Jsp standard tag library provide some set of tags for application development in Jsp.
To implement jstl taglib directory is used.
<%@taglib prefix=“value”  uri=“value” %>
It allow tag within tag means it allow jsp , html tag within jstl tag.
Separate the business logic to presentation logic
Provide tag for core programming tags such as iteration(loop) ,conditional ,exception handling tags, xml support  tag , sql support tag, internationalization tag etc…

Jstl have 5 types of tag for better handling of jsp development:


  1.     core jstl tag
  2.     sql jstl tag
  3.     xml jstl tag
  4.     internationalization jstl tag
  5.     function jstl tag

Core Jstl tag:

The uri for core jstl is ‘http://java.sun.com/jsp/jstl/core , and prefix is ‘c’but we can change the prefix .
Core JSTL tag provide some core(basics) programming tags for development of web-application using jsp, such as……
  1. Variable support tag
  2. Iteration  tag
  3. Conditional tag
  4. Exception handling tag
  5. url and flow handling tags
  6. Syntax for defining core tags

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  1. <c:out/>:Used to take value from form and same page also.
  2. <c:catch>:Used to handle the exception , To handle exception  wraps the exceptional statements in catch tag .
  3. <c:import>:import the things form out side as well inside the web-application.
  4. <c:url>:to move inside and outside the web-app .
  5. <c:if>:to check the condition.
  6. <c:forEach>:to iterate or repeat the statement on a given condition.
  7. <c:choose>:to check the condition if condition is true then execute the body of <c:when> otherwise execute the body of <c:otherwise>

SQL Jstl Tag:

The JSTL SQL tag library provides the tag for sql support means database handling using jstl. It simplify the database handling make it tag based.
Basically, it  provides tags for interacting with relational databases (RDBMSs) such as Oracle, Mysql, or Microsoft SQL Server etc.
List of SQL JSTL Tags:
  1. <sql:setDataSource> :Creates a simple DataSource suitable only for prototyping
  2. <sql:query> :     Executes the SQL query defined in its body or through the sql attribute.
  3. <sql:update> :   Executes the SQL update defined in its body or through the sql attribute.
  4. <sql:param> :    Sets a parameter in an SQL statement to the specified value.
  5. <sql:dateParam> :Sets a parameter in an SQL statement to the specified java.util.Date value.
  6. <sql:transaction >:Provides nested database action elements with a shared Connection, set up to execute all statements as one transaction.

XML JstlTag:

The xml sql tags uri is  http://java.sun.com/jsp/jstl/xml and prefix is x.
Used for flow control ,transformation and core xml implementation.
<%@taglib prefix=“x” uri=“http://java.sun.com/jsp/jstl/xml” %>
For example:
<x:forEach  />
Some Tags:
  1. <x:choose>
  2. <x:forEach >
  3. <x:if />
  4. <x:otherwise/>
  5. <x:out />
  6. <x:param />
  7. <x:parse/>
  8. <x:transform/>
  9. <x:when />

 Internationalization Jstl tag:

Internationalization jstl tags support the message ,number and data formatting. The uri for the internationalization tags is ‘ http://java.sun.com/jsp/jstl/fmt’ and prefix is ‘fmt’.
Support i18n.
<%@taglib prefix=“fmt” uri=“http://java.sun.com/jsp/jstl/fmt ” %>
For Example:
Some Tags:
  1. <fmt:bundle basename="“/>
  2. <fmt:formatDate value=“”>:
  3. <fmt:message/>
  4. <fmt:parseDate/>
  5. <fmt:setLocale value=""/>
  6. <fmt:param/>
  7. <fmt:parseNumber/>
  8. <fmt:requestEncoding/>
  9. <fmt:requestEncoding/>
  10. <fmt:setBundle basename=""/>
  11. <fmt:setTimeZone value=""/>
  12. <fmt:timeZone value="“/> 

Function Jstl:

Functions jstl tags provide supportive tag for string and collections manipulation.
The uri for the functions tags is ‘http://java.sun.com/jsp/jstl/functions’ and prefix is ‘fn’ .
<%@taglib prefix=“fn” uri=“http://java.sun.com/jsp/jstl/functions” %>
For Example:
fn:indexOf()…… etc.

Reach us At: - 0120-4029000 / 24 / 25 / 27 / 29 Mbl: 9953584548
Write us at: - Smruti@apextgi.com and pratap@apextgi.com



No comments:

Post a Comment