JET Expressions Syntax Reference

JET Templates may emit the result of a Java expression by enclosing the Java expression between the characers <%= and %>.

Valid Expressions

Expressions contain valid Java expressions. Java expressions are not complete statements, and in particular, they do not include a semi-colon (;). Expressions may access any Java element inscope Java elemement, including fields and methods declared in Java declarations, or in Java scriptlets, or Implicit Java Objects.

The emitted Java code for the template will evaluate the Java expression and convert the result to a string (if necessary). The following are examples of Java expressions:

The name of the class executing is: <%= this.getClass().getName() %>

Although slightly silly, expression may be constant, like <%= 5 %> and <%= "hello" %>.

Invalid Expressions

Any syntax error in the Java expression will result errors in the emitted Java code. The JET compiler does not attempt to correlate the Java compile error back to the JET template. Some examples:

<%= 3 + 4; %> <%-- semicolon not allowed in Java expressions --%>

Escaping Expression characters

To emit the characters <%= in a templates output, enter <\%=. To emit %>, enter %\>