iTP Active Transaction Pages (iTP ATP) Programmer's Guide

ATP Web Page and Script Structure
iTP Active Transaction Pages (iTP ATP) Programmer’s Guide522292-002
3-3
Script and HTML
Script and HTML
You can include HTML within a server-side script, or script within HTML, depending
on the proportions of each that your application requires. ATP regards any HTML in the
clear as passive content of the page and passes it directly to the browser for processing.
Your script need not—and should not, for reasons of efficiency—explicitly print lines of
HTML to the browser: ATP passes multiple lines of HTML in a single operation.
The code fragment in Example 3-1
illustrates a combination of server-side script and
HTML in the clear, with server-side JavaScript and its delimiters highlighted. Wherever
one or more lines of HTML appear in the clear—for instance, before the first
<server> tag or between the </server> tag and the first backquote ()— ATP
passes the lines in a single print operation to the browser. (In this example, all the
HTML between the do and while statements is passed to the browser repeatedly,
once for each execution of the loop.) For expressions like ‘account_id()‘, which
refer to functions that return table data from ATP objects, ATP evaluates the expression
and passes the value to the browser at the location where the expression occurred in the
HTML.
Example 3-1. Server-Side Script and HTML
<table border=3 cellpadding=3 cellspacing=3>
...
<!--HTML to print the column headings (omitted here)-->
...
<server>
do {
</server>
<tr>
<!-- The from radio button...-->
<td align=center>
<input type=radio name=FromAccount value=‘account_id();‘>
</td>
<!-- The data about the account...-->
<td align=center> ‘last_name();‘ </td>
<td align=center> ‘first_name();‘ </td>
<td align=center> ‘account_id();‘ </td>
<td align=center> ‘balance();‘ </td>
<!-- The to radio button...-->
<td align=center>
<input type=radio name=ToAccount value=‘account_id();‘>
</td>
</tr>
<server>
}
while (nextAcct() && rowCount++ <10);
</server>
...
</table>