Conditional Content:
The If, ElseIf,
and Else tokens conditionally include or skip over sections
of page content. In this example, a message to preferred customers
is included when PreferredCustomer is true.
JOT.If(JOT.PreferredCustomer)
<b>Thanks for being a Preferred Customer!</b>
JOT.ElseIf(JOT.Not(JOT.InactiveCustomer))
<b>We want you to become a Preferred Customer!</b>
JOT.Else
<b>Please activate your account!</b>
JOT.End <!-- [end of IF-ELSE section] -->
Repeating Content:
The Repeat token repeats a section of page content, such as
for a list or for each row of a table. The Next token is used
to advance to the next element in a repeated section.
The More token determines if there are any more elements
remaining in the repeated section. In the following example,
a table row is generated for each shopping cart item,
followed by a table row for the total purchase price.
If there are no items then the table is not shown.
JOT.If(JOT.Items.More)
<table>
JOT.Repeat(JOT.Items.Next)
<tr><td>JOT.Items.ProdcutName</td></tr>
JOT.End <!-- [end of repeated rows section] -->
<tr><td>JOT.Items.TotalPurchase</td></tr>
</table>
JOT.End <!-- [end of table IF section] -->
JOT Web Components:
JOT Web Components render dynamic content inside an enclosing JOT Template.
The dynamic page is then
a composite view rendered with the nested JOT Templates. There is
no limit to the nesting depth of JOT Web Components. The following
example fills a table cell with a JOT Web Component that uses its own
nested JOT Template to render customer information.
<tr><td>JOT.CustomerInfo</td></tr>
The Content token specifies a JOT Template name for the
component. This example renders customer information using a
WML template (Wireless Markup Language):
<tr><td>JOT.CustomerInfo.Content(/webpages/CustomerInfo.wml)</td></tr>
The ShoppingCart JOT Bean in the next example has a CustomerInfo
component and a ShoppingCart ItemsList component. These components
each render dynamic content with their own JOT Templates
inside the enclosing template.
<hr>
<!-- Render customer information fields -->
JOT.ShoppingCart.CustomerInfo
<p>
<!-- Render table of selected items -->
JOT.ShoppingCart.ItemsList
<hr>
Configuration Components:
A component that only assigns property values can be used to configure
another component. For instance, this configuration template configures
discount prices during a sale.
<!-- - - - - - - MyAppSetup.config - - - - - - -->
JOT.SaleInProgress=(JOT.True)
JOT.SaleEndDate=(07/15/2008)
The following customer shopping cart template loads setup values
from the above configuration component.
<!-- - - - - - - MyApp.html - - - - - - -->
<html>
JOT.Content(MyAppSetup.config)
<title>JOT.CustomerName Shopping Cart</title>
<body>
JOT.If(JOT.SaleInProgress)<p>Sale Prices good until JOT.SaleEndDate!JOT.End
.
.
.
</body>
</html>