Coercion Rules
The EL automatically converts, or coerces, variable values and the result of an expression to the type required by an attribute or an operator:
|
To Java type |
Conversion rule |
String |
All other types: to the corresponding |
Primitive number or Number |
Numeric types: coerce to the requested precision. |
boolean or Boolean |
null: to
|
|
Other type |
String: use the Other: type cast, if possible. |
In all cases, the EL evaluator throws an exception for attempts to convert between types not defined in the table or if the defined conversion rule fails.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access