Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse JET Guide
Previous Page Home Next Page

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 %\>

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire