JSTL standard template library for JSP
Resin 3.1

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
EL
JSP
Directives

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>
      

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