Basic Operators
EL supports most of the arithmetic and logic operators provided by Java.
Operator List
Operator |
Description |
---|---|
. |
Accesses a Bean property or a mapping entry. |
[] |
Accesses an array or linked list. |
() |
Organizes a subexpression to change priority. |
+ |
Plus sign |
- |
Minus or negative sign |
* |
Multiplication sign |
/ or div |
Division sign |
% or mod |
Modulo |
== or eq |
Test whether equal to. |
!= or ne |
Test whether unequal to. |
< or lt |
Test whether less than. |
> or gt |
Test whether greater than. |
<= or le |
Check whether less than or equal to. |
>= or ge |
Test whether greater than or equal to. |
&& or and |
Test logic and. |
|| or or |
Test logic or. |
! or not |
Test negation. |
empty |
Test whether empty. |
?: |
The expression is similar to if else. If the statement in front of ? is true, the value of the expression between ? and : is returned. Otherwise, the value following : is returned. |
Example
If variable a is empty, default is returned. If variable a is not empty, a itself is returned. The EL expression is as follows:
#{empty a?"default":a}
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot