Jet (Jaskell Engine for Template) Documentation:

Jet (Jaskell Engine for Template) Documentation
b Equivalent to tag "b"
br to generate <br>
comment suppress a string so that it doesn't show up in the result
escape to escape a string for html
fmt to convert a date or a number to the desired pattern
format to convert a date or a number to the desired format
href to generate a hyper link
html Html related Jet functions
html.b Equivalent to tag "b"
html.br to generate <br>
html.escape to escape a string for html
html.href to generate a hyper link
html.i Equivalent to tag "i"
html.li Equivalent to tag "li"
html.nbsp Equivalent to "&nbsp;"
html.p Equivalent to tag "p"
html.tag to spit out a named tag
html.td Equivalent to tag "td"
html.th Equivalent to tag "th"
html.tr to create a html table row. Each column is automatically wrapped by <td> and </td>
html.ul to create a html list. Each list item is automatically wrapped by <li> and </li>
html.unescape to un-escape a string for html
i Equivalent to tag "i"
if_exists Evaluates to empty string when a variable or a method referenced by an expression is not defined or null
if_na Provides a default value when a variable or a method referenced by an expression is not defined or null
if_null Provides a default value when NullPointerException is thrown or the expression evaluates to null.
if_undefined Provides a default value when a variable or a method referenced by an expression is not defined
include to load the content of a text file
jaskell the tuple containing all jaskell predefined functions.
java the java classes whose package names start with "java." and pre-loaded by 'importStandardClasses'.
javax the java classes whose package names start with "javax." and pre-loaded by 'importStandardClasses'.
jet General Jet functions
jet.comment suppress a string so that it doesn't show up in the result
jet.fmt to convert a date or a number to the desired pattern
jet.format to convert a date or a number to the desired format
jet.if_exists Evaluates to empty string when a variable or a method referenced by an expression is not defined or null
jet.if_na Provides a default value when a variable or a method referenced by an expression is not defined or null
jet.if_null Provides a default value when NullPointerException is thrown or the expression evaluates to null.
jet.if_undefined Provides a default value when a variable or a method referenced by an expression is not defined
jet.include to load the content of a text file
jet.sequence create a string by sequentially serialize objects in a list using a serializer function
jet.unless infix modifier function for conditionally spitting out a string.
jet.when infix modifier function for conditionally spitting out a string.
li Equivalent to tag "li"
nbsp Equivalent to "&nbsp;"
out the output object
p Equivalent to tag "p"
request the request object
response the response object
sequence create a string by sequentially serialize objects in a list using a serializer function
tag to spit out a named tag
td Equivalent to tag "td"
th Equivalent to tag "th"
tr to create a html table row. Each column is automatically wrapped by <td> and </td>
ul to create a html list. Each list item is automatically wrapped by <li> and </li>
unescape to un-escape a string for html
unless infix modifier function for conditionally spitting out a string.
when infix modifier function for conditionally spitting out a string.

API Detail

b

Equivalent to tag "b"

br

to generate <br>

comment

suppress a string so that it doesn't show up in the result

String comment(Object commented)

For example:

      comment "this is a comment"


escape

to escape a string for html

String escape(String s)

require Apache Commons-Lang library in the classpath


fmt

to convert a date or a number to the desired pattern

This function has 2 overloaded versions:


format

to convert a date or a number to the desired format

This function has 2 overloaded versions:

The specification of numberformat or dateformat object can be found in jaskell.date.format and jaskell.number.format functions


href

to generate a hyper link

String href(String link, String title)

For example:

      href "http://www.mycompany.com" "My Company"


html

Html related Jet functions

html.b

Equivalent to tag "b"

html.br

to generate <br>

html.escape

to escape a string for html

String escape(String s)

require Apache Commons-Lang library in the classpath


html.href

to generate a hyper link

String href(String link, String title)

For example:

      href "http://www.mycompany.com" "My Company"


html.i

Equivalent to tag "i"

html.li

Equivalent to tag "li"

html.nbsp

Equivalent to "&nbsp;"

html.p

Equivalent to tag "p"

html.tag

to spit out a named tag

String tag(String name, String content)

The following example is equivalent to <B>hello world</B>

      tag "B" "hello world"


html.td

Equivalent to tag "td"

html.th

Equivalent to tag "th"

html.tr

to create a html table row. Each column is automatically wrapped by <td> and </td>

String tr(List list)


html.ul

to create a html list. Each list item is automatically wrapped by <li> and </li>

String ul(List list)


html.unescape

to un-escape a string for html

String unescape(String s)

require Apache Commons-Lang library in the classpath


i

Equivalent to tag "i"

if_exists

Evaluates to empty string when a variable or a method referenced by an expression is not defined or null

Object if_exists(Expression expr)

Normally called in such syntax: some_expr->if_exists


if_na

Provides a default value when a variable or a method referenced by an expression is not defined or null

Object if_na(Object default_value, Expression expr)

Normally called in such syntax: some_expr->if_na def_value


if_null

Provides a default value when NullPointerException is thrown or the expression evaluates to null.

Object if_null(Object default_value, Expression expr)

Normally called in such syntax: some_expr->if_null def_value


if_undefined

Provides a default value when a variable or a method referenced by an expression is not defined

Object if_undefined(Object default_value, Expression expr)

Normally called in such syntax: some_expr->if_undefined def_value


include

to load the content of a text file

StringBuffer include(java.util.Map options)

The options tuple can contain the following members:


jaskell

the tuple containing all jaskell predefined functions.

java

the java classes whose package names start with "java." and pre-loaded by 'importStandardClasses'.

javax

the java classes whose package names start with "javax." and pre-loaded by 'importStandardClasses'.

jet

General Jet functions

jet.comment

suppress a string so that it doesn't show up in the result

String comment(Object commented)

For example:

      comment "this is a comment"


jet.fmt

to convert a date or a number to the desired pattern

This function has 2 overloaded versions:


jet.format

to convert a date or a number to the desired format

This function has 2 overloaded versions:

The specification of numberformat or dateformat object can be found in jaskell.date.format and jaskell.number.format functions


jet.if_exists

Evaluates to empty string when a variable or a method referenced by an expression is not defined or null

Object if_exists(Expression expr)

Normally called in such syntax: some_expr->if_exists


jet.if_na

Provides a default value when a variable or a method referenced by an expression is not defined or null

Object if_na(Object default_value, Expression expr)

Normally called in such syntax: some_expr->if_na def_value


jet.if_null

Provides a default value when NullPointerException is thrown or the expression evaluates to null.

Object if_null(Object default_value, Expression expr)

Normally called in such syntax: some_expr->if_null def_value


jet.if_undefined

Provides a default value when a variable or a method referenced by an expression is not defined

Object if_undefined(Object default_value, Expression expr)

Normally called in such syntax: some_expr->if_undefined def_value


jet.include

to load the content of a text file

StringBuffer include(java.util.Map options)

The options tuple can contain the following members:


jet.sequence

create a string by sequentially serialize objects in a list using a serializer function

StringBuffer sequence(List list, Function serializer)

The following code evaluates to <li>a</li><li>b</li>

      sequence ["a","b"] li

sequence also supports an alternative syntax that's more similar to imperative loop:

"sequence [1,2] li" is equivalent to "sequence {i=[1,2]} $ li i"


jet.unless

infix modifier function for conditionally spitting out a string.

Object unless(Object val, boolean cond)

For example:

      "hello world" `unless a==b


jet.when

infix modifier function for conditionally spitting out a string.

Object when(Object val, boolean cond)

For example:

      "hello world" `when a==b


li

Equivalent to tag "li"

nbsp

Equivalent to "&nbsp;"

out

the output object

p

Equivalent to tag "p"

request

the request object

response

the response object

sequence

create a string by sequentially serialize objects in a list using a serializer function

StringBuffer sequence(List list, Function serializer)

The following code evaluates to <li>a</li><li>b</li>

      sequence ["a","b"] li

sequence also supports an alternative syntax that's more similar to imperative loop:

"sequence [1,2] li" is equivalent to "sequence {i=[1,2]} $ li i"


tag

to spit out a named tag

String tag(String name, String content)

The following example is equivalent to <B>hello world</B>

      tag "B" "hello world"


td

Equivalent to tag "td"

th

Equivalent to tag "th"

tr

to create a html table row. Each column is automatically wrapped by <td> and </td>

String tr(List list)


ul

to create a html list. Each list item is automatically wrapped by <li> and </li>

String ul(List list)


unescape

to un-escape a string for html

String unescape(String s)

require Apache Commons-Lang library in the classpath


unless

infix modifier function for conditionally spitting out a string.

Object unless(Object val, boolean cond)

For example:

      "hello world" `unless a==b


when

infix modifier function for conditionally spitting out a string.

Object when(Object val, boolean cond)

For example:

      "hello world" `when a==b