JSTL Tutorials - Complete JSTL Tag References
- Details
- Written by Nam Ha Minh
- Last Updated on 05 March 2024   |   Print Email
1. JSTL Core Tags:
Use core tags for conditional constructs (if, else, loop), handling exceptions, print output, access request parameters, set variable, construct URLs...if | catch | choose | forEach | forTokens | import | out | param | redirect | remove | set | url
JSTL 1.2 taglib directive to use core tags:<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
JSTL 2.0 taglib directive to use core tags:<%@ taglib prefix="c" uri="jakarta.tags.core" %>
2. JSTL Format Tags:
Use format tags to format numbers, datetime, internationalization, set request encoding, set timezone...bundle | formatDate | formatNumber | message | param | parseDate | parseNumber | requestEncoding | setBundle | setLocale | setTimeZone | timeZone
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
JSTL 2.0 taglib directive to use format tags:<%@ taglib prefix="fmt" uri="jakarta.tags.fmt" %>
3. JSTL SQL Tags:
Use SQL tags to specify datasource, execute Select and Update queries.dateParam | param | query | setDataSource | transaction | update
JSTL 1.2 taglib directive to use SQL tags:<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
JSTL 2.0 taglib directive to use SQL tags:<%@ taglib prefix="sql" uri="jakarta.tags.sql" %>
4. JSTL XML Tags:
Use XML tags to parse XML document and transform XML using XSLT template.forEach | if | out | param | parse | set | transform | choose, when, otherwise
JSTL 1.2 taglib directive to use XML tags:<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>
JSTL 2.0 taglib directive to use XML tags:<%@ taglib prefix="x" uri="jakarta.tags.xml" %>
5. JSTL Function Tags:
Use function tags to manipulate Strings in JSP without using plain Java code.contains | containsIgnoreCase | endsWith | escapeXml | indexOf | join | length | replace | split | startsWith | substring | substringAfter | substringBefore | toLowercase | toUpperCase | trim
JSTL 1.2 taglib directive to use function tags:
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
JSTL 2.0 taglib directive to use function tags:
<%@ taglib prefix="fn" uri="jakarta.tags.functions" %>