2. Slide 2 of 21
Overview
JSTL
Core Tag Library
Methods using EL
I18N & Formatting Tag Library
SQL Tag Library
XML Tag Library
3. Slide 3 of 21
JSTL
Custom tags provide a way to reuse
valuable components
JSTL has reusable standard set of tags.
Provides the user with a script-free
environment
User can write code using tags instead of
Java code and scriptlets
JSTL tags are easier for non-programmers
and inexperienced programmers
4. Slide 4 of 21
JSTL - Types
JSP Standard Tag Library
(JSTL)
Core Tag
Library
I18N &
Formatting
Tag Library
SQL Tag
Library
XML Tag
Library
5. Slide 5 of 21
Core Tag Library
Core Tag Library
General
Purpose Tags
Decision
Making Tags
Iteration Tags
set remove out forEach forTokensif choose
13. Slide 13 of 21
SQL Tag Library
SQL Tag Library
setDataSource query update paramtransaction
14. Slide 14 of 21
SQL Tag Library – setDataSource tag
<%@ taglib uri = "http://java.sun.com/jsp/jstl/sql" prefix
= “sql" %>
– <sql:setDataSource dataSource=“datasource” |
url=“jdbcurl” driver=“jdbcclassdriver” user=“username”
password=“password” var=“varName” scope=“page |
request | session | application” />
15. Slide 15 of 21
SQL Tag Library – query tag
– <sql:query var=“varName” dataSource=“datasource”
scope=“page | request | session | application”>
SQL Statement
16. Slide 16 of 21
SQL Tag Library – update tag
– <sql:update var=“varName” dataSource=“datasource”
scope=“page | request | session | application”>
SQL Statement
• <sql:param value=“value” />
– </sql:update>
17. Slide 17 of 21
SQL Tag Library – transaction tag
– <sql:transaction dataSource=“datasource”
isolation=“isolationLevel”>
• <sql:update> or <sql:query> Statements
– </sql:transaction>
18. Slide 18 of 21
SQL Tag Library – transaction tag
19. Slide 19 of 21
param Tag
Param is used to set values for parameters
markers (“?”) in SQL statement
It acts as a sub tag for <sql:query> and
<sql:update>
20. Slide 20 of 21
Summary
JSTL
Core Tag Library
– General purpose Tags
– Decision making Tags
– Iteration Tags
21. Slide 21 of 21
Summary
Methods using EL
I18N & Formatting Tag Library
– Locale, Bundle, Message
– formatDate, formatNumber
SQL Tag Library
– setDataSource
– query
– update
– transaction
– param