caucho
Resin
FAQ
Reference Guide
Demo
Tutorial

JSP page
Config
URLs
Database Forms
XTP Copy
Hello Tag
Vary Filter
HardCore
Mailing Forms
Beans
Cache
XSL Filter
run-at

Formatting
XTP Page
JSP Tag Libraries with XTP
JSP Tag Libraries with StyleScript
 StyleScript examples

JSP Tag Libraries with XTP
XTP Copy
Hello Tag

  1. Counter
  2. JSP flow control

Counter

XTP pages can use the counter just by adding the tag:

counter.xtp
A counter example: <ct:counter id='test'/>

Here the patterns to do it. For efficiency, we've added the cache directive. The cache directive tells XTP to execute the stylesheet only once and cache the generated JSP file.
default.xsl
<#@ cache #>

counter[@id] <<
<%=
application.attribute["<{@id}>"]
%>
>>

counter <<
<%= application.attribute.counter++ %>
>>

JSP flow control

  • ct:get prints the value of a variable
  • ct:if generates an if statement
  • ct:iter loops
definition of ct:get

ct:get <<
<%= <{@expr}> %>
>>
definition of ct:if
ct:if <<
<% if (<{@expr}>) { %>
  <xsl:apply-templates/>
<% } %>
>>
definition of ct:iter
ct:iter[@index] <<
<% for (var <{@index}> in <{@expr}>) { %>
  <xsl:apply-templates/>
<% } %>
>>

ct:iter <<
<% for (var i in <{@expr}>) { %>
  <xsl:apply-templates/>
<% } %>
>>

JSP Tag Libraries with XTP
XTP Copy
Hello Tag
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.