Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'doc/org.eclipse.jet.doc/references/syntax/jetSyntaxScriptlets.xhtml')
-rw-r--r--doc/org.eclipse.jet.doc/references/syntax/jetSyntaxScriptlets.xhtml61
1 files changed, 61 insertions, 0 deletions
diff --git a/doc/org.eclipse.jet.doc/references/syntax/jetSyntaxScriptlets.xhtml b/doc/org.eclipse.jet.doc/references/syntax/jetSyntaxScriptlets.xhtml
new file mode 100644
index 0000000..d180d90
--- /dev/null
+++ b/doc/org.eclipse.jet.doc/references/syntax/jetSyntaxScriptlets.xhtml
@@ -0,0 +1,61 @@
+<?xml version='1.0'?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+
+ <head>
+
+ <title>JET Java Scriptlet Syntax Reference</title>
+
+ <link charset="ISO-8859-1" href="../../book.css" rel="STYLESHEET"
+ type="text/css"/>
+
+ </head>
+
+ <body>
+
+ <h2>JET Scriptlet Syntax Reference</h2>
+
+ <p>JET Templates may contain sections Java statements by enclosing
+ the Java expression between the characers <code>&lt;%</code> and
+ <code>%&gt;</code>.</p>
+
+ <h3>Valid scriptlets</h3>
+
+ <p>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
+ <a href="jetSyntaxDeclarations.xhtml">Java declarations</a> or
+ <a href="implicitJavaObjectsReference.xhtml">Implicit Java
+ Objects</a>. Some examples of valid scriplets:</p>
+
+ <pre>&lt;%
+int x = 3;
+%&gt;
+&lt;%
+int y = x * 6;
+%&gt;
+&lt;% if(y &gt;= 18) { %&gt;
+&lt;%-- The above scriptlet opens a block which is closed in the next scriptlet --%&gt;
+ Y is &gt;= 18
+&lt;% } %&gt;</pre>
+ <p>The emitted Java code for the template will contain the Java
+ statements in the generatation method.</p>
+
+ <h3>Invalid scriptlets</h3>
+
+ <p>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.</p>
+
+ <h3>Escaping Scriplet characters</h3>
+
+ <p>To emit the characters <code>&lt;%</code> in a templates output,
+ enter <code>&lt;\%</code>. To emit <code>%&gt;</code>, enter
+ <code>%\&gt;</code></p>
+
+ </body>
+
+</html>
+

Back to the top