JSTL (JSP Standard Tag Library)

JSTL stands for JSP Standard Tag Library. It provides the no. of tags used for iteration, condition checking, manipulating XML documents etc.

Advantages of JSTL:

  1. Code reusability.
  2. Scriplet tags are not needed.

Types of JSTL tags:

  1. JSTL Core Tags
  2. JSTL Formatting tags
  3. JSTL SQL tags
  4. JSTL XML tags
  5. JSTL Functions

 

1. JSTL Core Tags: These tags are used for iteration, condition checking, URL management etc. Core tags are most commonly used.

Syntax: <%@ taglib uri=”http://java.sun.com/jsp/jstl/core” prefix=”c”%>

2. JSTL Formatting tags: These tags are used for formatting the text, date, numbers etc.

Syntax: <%@ taglib uri=”http://java.sun.com/jsp/jstl/fmt” prefix=”fmt”%>

3. SQL tags: Theses tags are used for interacting with databases like Oracle, MySQL etc.

Syntax: <%@ taglib uri=”http://java.sun.com/jsp/jstl/sql” prefix=”sql”%>

4. XML tags: These tags are used forcreating and manipulating XML documents.

Syntax: <%@ taglib uri=”http://java.sun.com/jsp/jstl/xml” prefix=”x”%>

5. JSTL Functions: These function tags are mainly used for manipulating strings.

Syntax: <%@ taglib uri=”http://java.sun.com/jsp/jstl/functions” prefix=”fn” %>

JSTL (JSP Standard Tag Library) tutorial:

Custom tags tutorial: