Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Operators

In addition to the . and [] operators, the expression language provides the following operators:

  • Arithmetic: +, - (binary), *, / and div, % and mod, - (unary)
  • Logical: and, &&, or, ||, not, !
  • Relational: ==, eq, !=, ne, <, lt, >, gt, <=, ge, >=, le.
    Comparisons can be made against other values, or against boolean, string, integer, or floating point literals.
  • Empty: The empty operator is a prefix operation that can be used to determine whether a value is null or empty.

The precedence of operators highest to lowest, left to right is as follows:

[] .
() - Used to change the precedence of operators.
- (unary) not ! empty
* / div % mod
+ - (binary)
< > <= >= lt gt le ge
== != eq ne
&& and
|| or
? :

Some Examples:

Formula
Output
${5 + 3}8
${5 - 3}2
${5 / 3}1.67
${5 * 3}15
${5 % 3}2
${5 > 3} or ${5 gt 3}Yes
${5 >= 5} or ${5 >= 5}Yes
${5 < 3} or ${5 lt 3}No
${5 <= 5} or ${5 le 3}Yes

Literals

The JSP expression language defines the following literals:

Boolean: true and false. For example, ${entity.critical == true}, where entity is a task
String: with single and double quotes; " is escaped as \", ' is escaped as \', and \ is escaped as \\.
Null: null

 

  • No labels