REXXTAGS.org :: Scriptlets
Home Specs

A scriptlet contains REXX code, which is copied without modification in the translated page. A scriptlet may be included in a REXXTAGS page, or returned as part of a tag result.

Included scriptlets are copied to the translated file, which may be eventually cached, and executed at request time. Returned scriptlets are interpreted when the tag results are evaluated.

Syntax

REXXTAGS allows different syntactical notations for scriptlets.

Syntax 1 (included scriptlets only):

     <?rexx
     rexx code fragment
     ?>

Syntax 2 (included scriptlets only):

     <script type="rexx">
     rexx code fragment
     </script>

Syntax 3 (included scriptlets only):

     <script language="rexx">
     rexx code fragment
     </script>

Syntax 4 (included and returned scriptlets):

     <%
     rexx code fragment
     %> 

Syntax 1, 2 and 3 are inherited from Mod_Rexx standard RSPCOMP Rexx Server Pages compiler, are retained for compatibility, and may only be used in included scriptlets. Syntax 4 is special to REXXTAGS, and may be used in included or returned scriptlets. In all cases, delimiters must appear on a line by themselves.

Examples

     <%
     Do i = 1 To 10
     %>
     This line will appear 10 times<br />
     <%
     End
     %>

produces the following output:

This line will appear 10 times
This line will appear 10 times
This line will appear 10 times
This line will appear 10 times
This line will appear 10 times
This line will appear 10 times
This line will appear 10 times
This line will appear 10 times
This line will appear 10 times
This line will appear 10 times

Here's a similar example which makes use of expressions:

     <%
     Do i = 1 To 10
     %>
     The square of <%=i%> is <%=i*i%><br />
     <%
     End
     %>

Which prints:

The square of 1 is 1
The square of 2 is 4
The square of 3 is 9
The square of 4 is 16
The square of 5 is 25
The square of 6 is 36
The square of 7 is 49
The square of 8 is 64
The square of 9 is 81
The square of 10 is 100

/specs/scriptlet.html
Last update: 05/06/03 at 14:11
 Comments
Valid XHTML 1.0! Valid CSS!