JSF Expression Language Tooling |
The JSF Expression Language (JSF EL) tooling provides basic support for design time evaluation of JSF 1.1 EL. It implements parts of the following specifications:
JSF 1.1 Specification -- particularly chapters 5 and 9.JSP 2.0 Specification -- particularly chapter 2.
Expression |
Problem |
myBean.stringArrayProperty + myBean.booleanProperty |
The first operand is an array of strings. Arrays cannot be coerced to a numeric type supported by the addition operator |
-false |
Boolean 'false' cannot be coerced to a numeric type expected by the unary minus operator. |
!5 |
The numeric value '5' cannot be
coerced to a boolean required by the unary not operator (Note this is
what the specification says; some implementation use a C-style
number-to-boolean coercion and flag a warning). |
Example |
Problem |
<h:inputText rendered="#{myBean.arrayProperty}"/> |
The rendered attribute expects a boolean value. An array value can be coerced or converted to boolean |
<h:dataTable binding="#{myBeanSubClass.booleanProperty}"/> |
The
binding attribute expects a binding to a UIComponent object. The
boolean property can be neither converted or coerced to a valid type. |
Expression |
Constant Evaluation |
Reason |
5+3 |
8 |
All values in the expression are constant at design time. |
empty 'notEmpty' |
false |
Empty operator always returns false for non-null, non-empty strings. |
empty 5 |
false |
The empty operator always returns false if the argument is not a string, collection, array or map. |
-null |
0 |
The minus operator treats null as 0. |
Expression |
Description |
false && myBean.x |
This logical predicate always
evaluates to false regardless of the value of myBean.x. Because this
expression "short-circuits" on the first argument, myBean.x will never
be evaluated meaning any expected side-effects will not occur. |
true || myBean.x |
Similar to the above, myBean.x will never be evaluated because true or'd with any value is guaranteed to be true. |