|
JOT Templates > JOT JOT Tokens Reference
JOT Tokens Reference
Web Application Tokens:
Web Applications uses custom JOT Tokens to render content with
the properties of server-side Java objects. For example,
JOT.CustomerName is a JOT Token that references an application
specific CustomerName property. JOT Tokens can also reference servlet
properties such as Session attributes and Request parameters (from HTML
input tags). So JOT.LoginName could be a token
that references the LoginName Session attribute.
Logic Tokens:
Logic tokens are used for including or skipping sections of content
on a page depending on whether some condition is true or not.
The JOT Template example
illustrates these tokens.
| |
JOT.If(condition) :
Renders page content up to a matching JOT.End or JOT.Else token
if condition is true.
Example:
JOT.If(JOT.PreferredCustomer) ... JOT.End
|
| |
JOT.ElseIf(condition) :
Renders page content up to a matching JOT.End or JOT.Else token
if condition is true.
Example:
JOT.ElseIf(JOT.InactiveCustomer)
|
| |
JOT.Else :
Renders page content up to a matching JOT.End token.
|
| |
JOT.Boolean(value) :
Determines if value is a true condition. For numeric values the
result is true for non-zero and false for zero.
Example:
JOT.If(JOT.Boolean(JOT.OrderCount))
|
| |
JOT.Not(value) :
Determines if value is a false condition. This is the opposite of
JOT.Boolean.
Example:
JOT.If(JOT.Not(JOT.InactiveCustomer))
|
| |
JOT.True :
A true condition.
Example (always true):
JOT.If(JOT.True)
|
| |
JOT.False :
A false condition.
Example (always false):
JOT.If(JOT.False)
|
| |
JOT.Or([terms...]) :
Is a true condition if any of the terms are true.
Example:
JOT.If(JOT.Or([JOT.LoggedIn, JOT.PublicPage, JOT.TestMode]))
|
| |
JOT.And([terms...]) :
Is a true condition if all of the terms are true.
Example:
JOT.If(JOT.And([JOT.LoggedIn, JOT.SecurePage]))
|
| |
JOT.Null(content) :
Determines if content is null (missing).
Example:
JOT.If(JOT.Null(JOT.ShippingPreference))
|
| |
JOT.IfNull(content,alternate) :
Renders content, or renders alternate if content is null
(missing).
Example:
JOT.IfNull(JOT.Customer, JOT.NewCustomer)
|
| |
JOT.property.Equals(value) :
Is a true condition if the value of property equals value.
Example:
JOT.If(JOT.LoginId.Equals(JOT.CustomerId))
|
| |
JOT.bean.IsaProperty(propertyName) :
Determines if propertyName is a property of bean.
Example:
JOT.If(JOT.IsaProperty(roundTripChecked))JOT.RoundTripComponent()JOT.End
Another example:
JOT.If(JOT.Account.IsaProperty(jointOwner))JOT.Account.JointOwner()JOT.End
|
| |
JOT.bean.IfProperty(propertyName,alternate) :
Renders the property if propertyName is a property of bean
with non null content, or renders alternate otherwise.
Example:
<input type=text name="username" value="JOT.IfProperty(loginName, '')">
Another example:
JOT.Customer.IfProperty(nickName, JOT.Customer.FirstName)
|
Loop Tokens:
This group of tokens are used for repeating sections of page content, such
as for each row of a table.
The JOT Template example
illustrates these tokens.
| |
JOT.Repeat(condition) :
Repeats a section of page content up to a matching JOT.End token while
condition is true. The condition is usually a JOT.Next token.
Example:
JOT.Repeat(JOT.PurchasedItems.Next)
|
| |
JOT.ListName.Next :
Advances to the next element in a repeated section of page content.
Example:
JOT.Repeat(JOT.PurchasedItems.Next)
|
| |
JOT.ListName.More :
Determines if there are any more elements available for a repeated section
of page content.
Example:
JOT.If(JOT.PurchasedItems.More)
|
| |
JOT.ListName.Element :
References the current element in a repeated section
of page content.
Example:
JOT.PurchasedItems.Element.Price
- The properties of the current element are also automatically available,
so in this case
JOT.PurchasedItems.Price is the same thing.
|
| |
JOT.ListName.Position :
References the ordinal position (count) of the current element
in a repeated section of page content.
Example:
Caller number JOT.Caller.Position is JOT.Caller.Name
|
| |
JOT.ListName.Count :
References the total number of available elements
in a repeated section of page content. This token is only provided in
loops where the total number of elements can be determined.
Example:
JOT.Caller.Name has JOT.Caller.Count calls waiting
|
Content Tokens:
| |
JOT.Content(template) :
Renders a JOT Web Component with a specified JOT Template.
The JOT Web Components
section illustrates the use of this token.
Example:
JOT.CustomerInfo.Content(/webpages/CustomerInfo.wml)
|
| |
JOT.Views.Component(className)
and JOT.Views.Component(className,template):
Creates and renders a JOT Web Component.
Example:
JOT.Views.Component(com.examples.CustomerInfo)
|
| |
JOT.Include(resourceName) :
Includes content from a non-template resource such as a
file, URL, JSP Page, or Servlet.
Examples:
JOT.Include(/webpages/SomeStaticContent.html)
JOT.Include(http://www.foohost.org/myapp/FooPage.jsp)
|
| |
JOT.Object(class) :
Creates an object. The class argument can be
a Java class name or a property that refers to a class name.
Example:
JOT.FromAccount=(JOT.Object(com.examples.Account))
creates a JotBean named FromAccount that can be used like this:
JOT.FromAccount.Balance
|
| |
JOT.WebappURL(path) :
Produces a URL with the host name and web application name.
Example:
<base href=JOT.WebappURL(/path1/path2)>
produces a URL like:
<base href=http://host/myapp:9090/path1/path2>
|
| |
JOT.URLEncode(content) :
Encodes special characters with URL encoding. This is
intended for use with the query part of a URL that follows the '?'.
Example:
http://www.Foohost.org/myapp/path1?foo=JOT.URLEncode(I & thou)
produces a URL like:
http://www.foohost.org/myapp/path1?foo=I+%26+thou
|
| |
JOT.HTMLText(content) :
Replaces HTML markup symbols in content with HTML character entities.
Example:
<input type="checkbox" name="FooX" value="JOT.HTMLText(JOT.FooX)">
|
|