Simple way to output the value of a java variable.
Expression sections can appear anywhere in text or hash sections.
Essentially, instead of saying
one can say
[= whatever]. (both are exactly equivalent).
To prevent the tag from being recognized, this tag can be escaped by
prefixing the start tag with a backslash: \[=
If an expression contains a java array, such as:
x[i]], the ending ] of the array is seen as the end of the expression itself. The solution is to say: [= x[i\]]
A simple molly page containing a simple expression.
[= 2+2 ]
Expressions can contain either valid java expressions or previously
defined page variables.
int feel = 0;
String greeting = "Hello World";
[= greeting ]..
[= ((feel == 0) ?
"I feel good today" :
"I need a change")
Hello World..I feel good today
An expression is convenient when writing an attribute value.
String color = "#ccc";