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

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