## JET Scriptlet Syntax Reference

JET Templates may contain sections Java statements by enclosing the Java expression between the characers `<%` and `%>`.

### Valid scriptlets

Scripts may contain one more more valid Java statements or blocks. A scriptlet may also include a partial Java block, so long as a subsequent scriptlet completes it. Scriplets may reference any Java elements in scope, including variables declared in other scriptlets, and methods and fields declared in Java declarations or Implicit Java Objects. Some examples of valid scriplets:

    <%
    int x = 3;
    %>
    <%
    int y = x * 6;
    %>
    <% if(y >= 18) { %>
    <%-- The above scriptlet opens a block which is closed in the next scriptlet --%>
       Y is >= 18
    <% } %>

The emitted Java code for the template will contain the Java statements in the generatation method.

### Invalid scriptlets

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

### Escaping Scriplet characters

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