escapeXml or default features
of <c:out> are required).
In Section 4.2, behavior will now be defined as follows:
The expression to be evaluated is specified via the value attribute.
If the result of the evaluation is not a java.io.Reader object, then it is coerced to a String and is subsequently emitted into the current JspWriter object.
If the result of the evaluation is a java.io.Reader object, data is first read from the Reader object and then written into the current JspWriter object. This special processing associated with Reader objects should help improve performance when large amount of data must be read and then displayed to the page.
2.9 Default Values
It is often desirable to display a default value if the output of an action yields a null value. This can be done in a generic way in JSTL by exporting the output of an action via attribute var, and then displaying the value of that scoped variable with action <c:out>.
For example:
<fmt:formatDate var="formattedDate" value="${reservationDate}"/>
Date: <c:out value="${formattedDate}" default="not specified"/>
<c:import> exposes a String or Reader object, both of which are sequences of text characters. It is possible to specify the character encoding of the input resource via the charEncoding attribute. The values supported for charEncoding are the same as the ones supported by the constructor of the Java class InputStreamReader.
If the character encoding is not specified, the following rules apply:
If the localization context does not have any locale, the locale of the java.text.MessageFormat is set to the locale returned by the formatting locale lookup algorithm in section 9.3, except that the available formatting locales are given as the intersection of the number- and date- formatting locales. If this algorithm does not yield any locale, the locale of the java.text.MessageFormat is set to the runtime's default locale.
Inside the body of the
The context node for every XPath expression evaluation in JSTL
that does not appear in the body of an <x:forEach> tag is the
root of an empty document. Page authors wishing to work with documents
must therefore supply their own node(s) using an XPath variable
(see section 11.1.2).
Action <x:forEach> establishes for its nested actions a specific
context for XPath expressions evaluation. See section 12.6 for
details.
If your application executes in an environment that has JSTL 1.1, it
is however recommended that you migrate to JSTL 1.1 to take full
advantage of the new capabilities it offers. Details on how to migrate
your web-application from JSTL 1.0 to JSTL 1.1 are given in Section
C.2.
A web application developed for JSP 1.2 has a servlet 2.3 deployment
descriptor (web.xml). JSP 2.0 provides backwards compatibility for JSP
1.2 web applications by disabling by default the EL machinery
(i.e. evaluation of EL expressions) when a web application has a
servlet 2.3 deployment descriptor. A web application that uses JSTL
1.0 and which is deployed with a servlet 2.3 deployment descriptor
therefore runs without any modification in a J2EE 1.4 environment
because EL expressions are ignored by JSP 2.0, and JSTL 1.0 keeps
evaluating them as was the case with JSP 1.2.
To support backwards compatibility, JSTL 1.1 introduces new URIs that
must be specified to use the new capabilities offered in JSTL
1.1. Among these new capabilities is the evaluation of EL expressions
being performed by the JSP 2.0 container rather than JSTL itself. The
new URIs for JSTL 1.1 are as follows:
The JSTL 1.0 URIs are deprecated as of JSTL 1.1. If used, they should
normally appear in a web application that has a servlet 2.3 deployment
descriptor to disable the JSP 2.0 EL machinery. If used with a servlet
2.4 deployment descriptor, the JSP 2.0 EL machinery must be
explicitely disabled for the pages where the JSTL 1.0 tag libraries
are used. Consult the JSP specification for details.
Align behavior of <x:forEach> with <c:forEach>
Add attributes varStatus, begin, end, and step.
Default context node for Xpath expression evaluations
This will be clarified through the new section
"11.1.7 Default Context Node".
Replace attributes that start with "xml"
Names beginning with the string "xml" are reserved by the XML specification.
Response Encoding
The way formatting actions influence the encoding of the response needs to be
clarified in sections 8.4 and 8.10. Repeated calls to
ServletResponse.setLocale() will affect the character encoding of the
response only if it has not already been set explicitely.
Minor corrections
In both cases, the resulting locale is en_GB.
<sql:dateParam value="value" [type="{timestamp|time|date}"]/>
Deferred Changes
Provide adequate XML Namespace support for the XML actions
JSTL 1.0 does not currently provide adequate support for XML namespaces
in XPath expressions. Collaboration between the JSP, JAXP, and JSTL
specs is necessary to come up with the proper solution. This will therefore
be addressed in the next major revision of JSTL.
Appendix C. Compatibility & Migration
This appendix provides information on compatibility between different
versions of JSTL, as well as on how to migrate your web application to
take advantage of the new features of the latest JSTL release.
C.1 JSTL 1.1 backwards compatibility
JSTL 1.1 is backwards compatible with JSTL 1.0. This means that a
web-application that was developed to run with JSTL 1.0 won’t require
any modification when run with JSTL 1.1. Details explaining how this
backwards compatibility is achieved are given in Section C.1.1
below. C.1.1How JSTL 1.1 backwards compatibility is achieved
JSTL 1.0 requires JSP 1.2 (J2EE 1.3 platform). The key difference
between JSTL 1.0 and JSTL 1.1 is that the expression language (EL) has
moved from the JSTL specification to the JSP specification. The EL is
therefore now part of the JSP 2.0 specification, and JSTL 1.1 requires
JSP 2.0 (J2EE 1.4 platform).
The new URIs are similar to the old JSTL 1.0 EL URIs, except that jsp/ has been
added in front of jstl, stressing JSTL's dependency on the JSP specification (which
now "owns" the EL). It would have been desirable to move forward with the same
EL URIs in JSTL 1.1, however this would have only been possible at the cost of
losing full backwards compatibility. The JSTL Expert Group felt that maintaining
backwards compatibility was more important than preserving the old URIs.
C.2. Migrating to JSTL 1.1
To migrate from JSTL 1.0 to JSTL 1.1, so a web application can take
advantage of the new features associated with JSTL 1.1, one must do
the following: