JSP - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

JSTL

JSTL

shape Description

JSTL stands for The JSP standard Tag Library is used to simplify the JSP development to represent a set of tags. It gives support to iteration and conditional tasks, underpins the tags to control the xml files, it underpins skeleton to the merged existed custom tags. The following are the advantages of JSTL.

The main tags in the JSTL

shape Table

Tag Name Description
Core tags Core tags provide variable support, flow control and URL administration and so on and the url tag is.http://java.sun.com/jsp/jsti/core .
Internationalization tags The tag gives backing to message formating, number and date designing and so on. What's more, the url's tag is http://java.sun.com/jsp/jstl/fmt and where fmt is the prefix.
SQL tags Provides SQL support and the URL for SQL tag is http://java.sun.com/jsp/jstl/sql and where prefix is sql.
Functions tags Function tags gives support for sting manipulation and length and the URL tag is http://java.sun.com/jsp/jstl/functions and where  fn is the prefix.
XML tags xml SQL labels give change, stream control and so forth and the URL is http://java.sun.com/jsp/jstl/xml and x is the prefix.

JSTL core tags

shape Description

Core tags provide variable support, flow control and URL administration and so on and the url tag is.http://java.sun.com/jsp/jsti/core. The following is the syntax to represent core tags.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
Tag Name Description
<c:catch> It will be use full in exception tag.
<c:out> The syntax is same like expression tag that<%=...>.
<c:remove> To remove the attribute from the scope.
<c:set> To set the variable value in a scope.
<c:when> Same like case statement.
<c:otherwise> It will be used when the condition is false.
<c:if> To test the conditions.
<c:choose> Same like switch statement.
<c:import> To retrieve the content from other files.
<c:forEach> Executing the same arrangement of statements for a limited number of times.
<c:forTokens> It will be used for iteration yet it just works with delimiter.
<c:url> It will be used to create a new URL with parameters.
<c:redirect> It redirects to a new URL.

JSTL Function Tags

shape Description

Function tags gives support for sting manipulation and length and the URL tag is http://java.sun.com/jsp/jstl/functions and where  fn is the prefix.
Tag Name Description
fn:contains() To inspect whether the given string is available in the input as sub-string.
fn:containsIgnoreCase() It does a case uncaring verify whether the permitted string is a sub-string of information.
fn:indexOf() It is utilized for discovering the begin position of a string in the endowed string. Returns -1 if string is not identified in the information.
fn:split(): To split the string as substring.
fn:join() It is used to Connect entirely components of an array into a string.
fn:escapeXML() It is utilized to dodge the characters that could be decoded as XML markup.
fn:length() To find the length of string and strives the components available in the collection.
fn:startsWith() It is used to check if an information string initiates with the predetermined prefix.
fn:endsWith() To check the suffix of the string.
fn:trim() To vanish the gap of the string at staring and at ending.
fn:substring() To get the substing from the main string.
fn:substringAfter() Gives back a subset of a string taking after a particular substring.
fn:substringAfter() Strive for string in the information and supplant it with the supplied string.
fn:ToLowerCase() To convert the characters of the string to lower case.
fn:ToUpperCase() To convert the characters of the string to upper case.
fn:substringBefore() Gives back a subset of a string taking before a particular substring.

JSTL XMLtags

shape Description

xml SQL labels give change ,stream control and so forth and the URL is http://java.sun.com/jsp/jstl/xml and x is the prefix.
Tag Name Description
<x:parse> To parse XML information indicated either by means of aN attribute.
<x:out> It is same like <%=...> but it will be used only for xpath expression.
<x:if> If condition is true, it approaches its body otherwise body will be rejected.
<x:set>  Keep the variable value to xml path expression.
<x:choose> This tag that builds up a connection for totally unrelated contingent operations.
<x:otherwise> It is use full, when condition will be false.
<x:forEach> To circle over center points in a XML report.
<x:when> If condition is true only.
<x:param> To keep the  arguments in the XSLT stylesheet.
<x:transform> To provide XSL alteration to the XML report.

JSTL Internationalization Tags

shape Description

The tag gives backing to message formating, number and date designing and so on. What's more, the url's tag is http://java.sun.com/jsp/jstl/fmt and where fmt is the prefix.
Tag Name Description
<fmt:requestEncoding> To encode the characters of a solicitation.
<fmt:message> To show formatted messages.
<fmt:parseDate> To parse the date and time of a string.
<fmt:formatDate> Positions a date and/or time utilizing the conveyed styles.
<fmt:setBundle> Loads a benefit pack and stores in the variable.
<fmt:setLocale> Stores the locale in the variable.
<fmt:bundle> Loads an asset pack to be utilized by its label body.
<fmt:timeZone> Used to determine timezone for at whatever time formatting.
<fmt:setTimeZone> Stores the time zone in a variable.
<fmt:parseNumber> Analyze  the string illustration of a number.
<fmt:formatNumber> To depict statistical value with particular exactness.

JSTL SQL Tags

shape Description

Provides SQL support and the URL for SQL tag is http://java.sun.com/jsp/jstl/sql and where prefix is sql.
Tag Name Description
<sql:setDataSource> Creates simple data source.
<sql:query> Accomplishes the SQL query characterized in its body.
<sql:param> Providing the parameters to sql query.
<sql:update> Accomplishes the SQL update characterized in its body.
<sql:dateparam> Provide the parameters to specified java.util.Date.
<sql:transaction> Gives settled database activity components with a common Connection, set up to execute all transactions as one exchange.

Summary

shape Key Points

  • JSTL XML tags underpins a JSP centric way to handle XML document.
  • SQL tags used to integrate with RDBMS.
  • JSTL avoids the using of scriplet tag.