Caucho Technology
documentation
examples
changes

overview
quick start
installation
command-line
configuration
admin
amber
clustering
caching
database
deployment
ejb 3.0
embedding
filters
hessian
hmtp
ioc
jsp
logging
messaging
performance
quercus/php
remoting
scheduled tasks
security
server push
servlets
third-party
troubleshooting
virtual hosting
watchdog
webapp
xml and xslt

introduction
compilation
el
jstl
directives
variables
actions
applications
schema for jsp-2.0 .tld files
velocity syntax
jsp templates

jstl standard template library for jsp


JSTL provides standard actions for functionality most often needed by page authors. This functionality includes a core library for the most common tasks, internationalization (i18n) and text formatting, relational database access (SQL), and XML processing.

Resin can generate more efficient code for JSTL than for other tag libraries. It is recommended that applications use JSTL as a basis for any JSP pages which can use it.

JSTL support in Resin is enabled by default

Because Resin automatically adds JSTL support, applications can start using JSTL by adding the taglib to the JSP without additional configuration:

Using c:out and c:if
<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %>
<c:if test="${'${'}param.test == 'a'}">
  <c:out value="The parameter is ${'${'}param.test}"/>
</c:if>
      

For several of the more important tags, Resin's JSP compiler will generate more efficient code than is possible with the straight tag library. This "fast-jstl" can be disabled in the resin.conf:

Disabling fast JSTL
<caucho.com>
<http-server>
  <jsp fast-jstl='false'/>
  ...
</http-server>
</caucho.com>
      

Because any bugs in the tag libraries are specific to the tag, even when using Resin in combination with another JSTL implementation, please report the specific tag and tag usage for JSTL bugs.

Velocity syntax maps to JSTL core

Resin's experimental Velocity-style syntax now maps directly to JSTL tags, providing a more standard basis for the Velocity-style syntax.

Velocity-style syntax can either be enabled on a per-JSP page with velocity='true' or in the web-app with the <jsp> tag:

Enabling velocity for a web-app
<web-app>
  <jsp velocity='true'/>
  ...
</web-app>
          

An example use of the Velocity-style syntax would be:

Velocity style
<jsp:directive.page velocity='true'/>
#{
int count;
}#

<h3>A sample $\{count}</h3>

#if ("foo" == params.a)
  <h3>Foo!</h3>
#else
  <h3>Bar!</h3>
#end
      

The above page is equivalent to the following JSP page using JSTL:

JSTL equivalent
<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %>
<jsp:scriptlet>
int count;
</jsp:scriptlet>

<h3>A sample <c:out value="${'${'}count}"/></h3>

<c:choose>
<c:when test="${'${'}'foo' == params.a}">
  <h3>Foo!</h3>
</c:when>
<c:otherwise>
  <h3>Bar!</h3>
</c:otherwise>
</c:choose>
      

Copyright © 1998-2008 Caucho Technology, Inc. All rights reserved.
Resin ® is a registered trademark, and Quercustm, Ambertm, and Hessiantm are trademarks of Caucho Technology.