A JSTL Tutorial by Examples
March 23, 2010 01:43:47 Last update: September 03, 2010 14:21:15
This is a bare bones, no frills, just the facts tutorial on JSTL. I will not bother you with theories, principles, best practices, anecdotes, or any other junk, because JSTL is shallow and simple, and I don't want to make it sound deep or complex.
Getting ready
Core Tags
Internationalization (i18n) and formatting tags
SQL tags
SQL tags are used to run SQL statements. I don't know why they are in JSTL, but since they are, you can use them if you want to.
Functions
XML tags
Getting ready
- JSTL/JSP Expression Language
- JSTL implicit variables
- A simple test application for JSTL
- Expanding the simple JSTL test application
Core Tags
- Basic tags:
<c:out>,<c:set>,<c:remove>,<c:catch> - Flow control tags:
<c:if>,<c:choose>,<c:when>,<c:otherwise>,<c:forEach>,<c:forTokens> - URL Tags:
<c:import>,<c:url>,<c:redirect>,<c:param>
Internationalization (i18n) and formatting tags
- I18N Overview
- Set locale:
<fmt:setLocale>,<fmt:requestEncoding> - Format messages:
<fmt:message>,<fmt:bundle>,<fmt:setBundle>,<fmt:param> - Format number and date:
<fmt:formatNumber>,<fmt:parseNumber>,<fmt:formatDate>,<fmt:parseDate>,<fmt:setTimeZone>,<fmt:timeZone>
SQL tags
SQL tags are used to run SQL statements. I don't know why they are in JSTL, but since they are, you can use them if you want to.
- Set datasource:
<sql:setDataSource> - Query:
<sql:query>,<sql:param> - Update and transaction:
<sql:update>,<sql:param>,<sql:dateParam>,<sql:transaction>,
Functions
- Collection length:
<fn:length> - String manipulation functions:
<fn:toUpperCase>,<fn:toLowerCase>,<fn:substring>,<fn:substringAfter>,<fn:substringBefore>,<fn:trim>,<fn:replace>,<fn:indexOf>,<fn:startsWith>,<fn:endsWith>,<fn:contains>,<fn:containsIgnoreCase,<fn:split>,<fn:join>,<fn:escapeXml>
XML tags
- Overview
- XML core tags:
<x:parse>,<x:out>,<x:set> - XML flow control tags:
<x:if>,<x:choose>,<x:when>,<x:otherwise>,<x:forEach> - XML transform tags:
<x:transform>,<x:param>