Caucho maker of Resin Server | Application Server (Java EE Certified) and Web Server


 

Resin Documentation

home company docs 
app server 
 Resin Server | Application Server (Java EE Certified) and Web Server
 

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-2015 Caucho Technology, Inc. All rights reserved. Resin ® is a registered trademark. Quercustm, and Hessiantm are trademarks of Caucho Technology.

Cloud-optimized Resin Server is a Java EE certified Java Application Server, and Web Server, and Distributed Cache Server (Memcached).
Leading companies worldwide with demand for reliability and high performance web applications including SalesForce.com, CNET, DZone and many more are powered by Resin.

home company docs 
app server