Skip to main content
This revision made August 26, 2011 22:18, by Kin-man Chung

Operators

String Concatenation

Syntax

 A # B
  1. Coerce A and B to String. Note: according 1.18.2, a null is coerced to "".
  2. Return the concatenated string of A and B.

Operator Precedence

 The precedence for # is lower than "+" and "-" (binary) but higher than logical operators (== != etc.)

Example

1 # 2 returns "12"

"1" # "2" returns "12"

Assignment

Syntax

expr-a = expr-b

  • expr-a must be a lvalue, and must be either a single variable (e.g. name) or a property resolution on some object, via . or [] operator. (e.g. employee.name). Note that this rule will be automatically enforced by setting the ELResolvers to be writable only for these syntaxes.
  • Evaluate expr-a, up to (but not including) the last property resolution.
    • If expr-a is a . or [] operator, evaluate the base to base-a, and the property to prop-a.
      • If base-a is null, throw a BeanNotFoundException.
      • If prop-a is null, throw a PropertyNotFoundException.
    • If expr-a is a single variable var.
      • If var cannot be resolved and is therefore non-existent, create it as an EL variable in the ELContext.
  • Evaluate expr-b to value-b.
  • Invoke ValueExpression.setValue for expr-a:
    • expr-a.setValue(context, value-b);
  • If ValueEpxression.getValue was called to initiate this expression evaluation, return value-b.
  • If ValueExpression.setValue was called to initiate this expression evaluation, throw a PropertyNotWritableException.

The last two bullet items ensure that the assignment operator returns the correct value, and that it is not writable.

Operator Precedence

It has the lowest precedence, lower than the ?: operator.

Example

 "x = a.b"
  If x does not exist then same as calling defineVariable("x", "#{a.b});
  "x.y = a.b"
  Set x.y = a.b. Error if x does not exist.


Difference compared to previous revision
=Operators= ==String Concatenation== ===Syntax=== A # B # Coerce A and B to String. Note: according 1.18.2, coercing =Operators= ==String Concatenation== ===Syntax=== A # B # Coerce A and B to String. Note: according 1.18.2, a ''null''a null String is rcoeturnserced ato "". # Return the concatenated string of A and B. ===Operator Precedence===
 
 
Close
loading
Please Confirm
Close