Java Reference
In-Depth Information
The c:choose - c:when - c:otherwise block mirrors the functionality of a switch - case -
default Java statement, displaying enclosed HTML output only for the first c:when
action that has a test attribute with the value true . If none of the actions is true , the
c:otherwise contents are displayed.
JSTL is composed of five tag libraries:
The core library (prefix c , default URI http://java.sun.com/jsp/jstl/core) contains
general features: output, conditional display of content, looping, variable creation
in several scopes, JavaBeans access, exception handling, URL imports, and URL
redirection.
n
The SQL library (prefix sql , default URI http://java.sun.com/jsp/jstl/ sql ) covers
database access: data source selection, queries, updates, transactions, and looping
through results.
n
The internationalization and formatting library (prefix fmt , default URI
http://java.sun.com/jsp/jstl/ fmt ) offers these actions: locale and resource bundle
use, text localization, and number and date formatting.
n
The XML processing library (prefix x , default URI http://java.sun.com/jsp/jstl/ xml )
supports XML: parsing, XPath access, XSLT transformation, looping through
nodes, and conditional processing.
n
The function library (prefix fn , default URI http://java.sun.com/jsp/jstl/functions)
contains useful functions to manipulate strings and collections.
n
The Expression Language has operators to retrieve information from instance variables
( ${object.varName} ), data structures ( ${object[“name”]} ), and indexed arrays or lists
( ${object[1]} ).
There also are operators for arithmetic (“+”, “-”, “*”, “/”, and “%”), comparisons (“==”,
“!=”, “<”, “<=”, “>”, and “>=”), logic (“&&”, “||”, and “!”), and empty , which detects
null objects and empty strings or collections. Parentheses can be used to group subex-
pressions.
The language offers automatic type conversion and five kinds of literals: strings, which
are enclosed within single or double quotes, integers, floating-point numbers, boolean
values ( true or false ), and null .
There are seven special variables available in any expression:
cookie , a collection of all request cookies, each as an instance of the Cookie class
from the javax.servlet.http package
n
header , a collection of all request headers, each as a string
n
Search WWH ::




Custom Search