JET Java Declaration Syntax Reference

JET templates may declare Java methods or fields by enclosing it within the characters <%! and %>.

Valid Declarations

Each declaration may contain one or more syntactically correct Java method or field declarations. The following are examples of valid declarations:

<%!
/**
 * Say hello the the addressee passed to the method
 */
public String hello(String addressee) {
   return "Hello " + addresseee + "!";
}
%>

<%!
// Declarations may contain multiple Java declarations
private int min(int a, int b) {
    return Math.min(a, b);
}

private int max(int a, int b) {
    return Math.max(a, b);
}
%>

Invalid Declarations

If a declaration contains an syntax error, the generated Java code for the containing template will have a syntax error. The JET compile does not attempt to correlate the Java compile error back to the JET template.

Escaping Declaration characters

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