Resin Documentationapp 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. Because Resin automatically adds JSTL support, applications can start using JSTL by adding the taglib to the JSP without additional configuration: <%@ 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: <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. 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 or in the web-app with the <jsp> tag:<web-app> <jsp velocity='true'/> ... </web-app> An example use of the Velocity-style syntax would be: <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: <%@ 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>
|