Jakarta Standard Tag Library (JSTL, formerly JSP Standard Tags Library) provides a set of XML-like tags that enable programmers/page authors mix Java code and HTML code in a JSP page to produce dynamic content. It simplifies JSP development in a way that developers do not have to write plain Java code in HTML page - thanks to reusable tags that are enough for almost needs.

If you're new to JSTL, I recommend you check this article first to get the key concepts and code examples: Introduction to Jakarta Standard Tag Library (JSTL).

If you're looking for usages and examples of some specific tags, the following list of JSTL tags will help. Click on each tag name to read the details including description, syntax and code examples.

 

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



JSTL 1.2 taglib directive to use format tags:

<%@ 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" %>


About the Author:

is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.