The core group of tags is the most commonly used JSTL tags. Following is the syntax to include the JSTL Core library in your JSP −
<%@ taglib prefix = "c" uri = "https://java.sun.com/jsp/jstl/core" %>
Following table lists out the core JSTL Tags −
S.No. | Tag & Description |
---|---|
1 | <c:out>Like <%= ... >, but for expressions. |
2 | <c:set >Sets the result of an expression evaluation in a 'scope' |
3 | <c:remove >Removes a scoped variable (from a particular scope, if specified). |
4 | <c:catch>Catches any Throwable that occurs in its body and optionally exposes it. |
5 | <c:if>Simple conditional tag which evalutes its body if the supplied condition is true. |
6 | <c:choose>Simple conditional tag that establishes a context for mutually exclusive conditional operations, marked by <when> and <otherwise>. |
7 | <c:when>Subtag of <choose> that includes its body if its condition evalutes to 'true'. |
8 | <c:otherwise >Subtag of <choose> that follows the <when> tags and runs only if all of the prior conditions evaluated to 'false'. |
9 | <c:import>Retrieves an absolute or relative URL and exposes its contents to either the page, a String in 'var', or a Reader in 'varReader'. |
10 | <c:forEach >The basic iteration tag, accepting many different collection types and supporting subsetting and other functionality . |
11 | <c:forTokens>Iterates over tokens, separated by the supplied delimeters. |
12 | <c:param>Adds a parameter to a containing 'import' tag's URL. |
13 | <c:redirect >Redirects to a new URL. |
14 | <c:url>Creates a URL with optional query parameters |