This revision made December 13, 2011 22:50, by Kin-man Chung

A & B

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

The precedence for & is lower than "+" and "-" (binary) but higher than logical operators (== != etc.). It is left-associative, i.e. a & b & c is (a & b)&c.

1 & 2 returns "12"

"1" & "2" returns "12"

expr-a = expr-b

- If expr-a is an identifier (name-a) and name-a is an EL variable (i.e. it is defined in the VariableMapper), or if name-a is not resolved by the ELResolver
- Set name-a in the VariableMapper with the ValueExpression for expr-b, without evaluation.
- Evaluate expr-b to value-b.

- Else
- Evaluate expr-b to value-b.
- 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.

- 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. In other words, the result of evaluating the assignment is the value of the right hand side.
- If ValueExpression.setValue was called to initiate this expression evaluation, throw a PropertyNotWritableException. An assignment expression cannot be the target of setValue.

Note that EL variables are bound at parse time, so their assignment in an expression only takes effect after the expression is evaluated. This can lead to some unexpected behaviors. For example, consider the following.

elp = new ELProcessor(); elp.setVariable("x", "10"); int n = elp.getValue("(x = 20) + x}";

The value of n is 30 instead of 40, because the value of x is 10 when the expression is parsed.

It is lower than the ?: operator, but higher than the , operator. It is also right-associative, i.e. a = b = c is a = (b = c).

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.

expr1, expr2

- expr1 is first evaluated, and its value is discarded.
- The expression (expr1, expr2) is then replaced by expr2 in the rest of evaluation

It has the lowest precedence, below that of = operator. It is left associative, i.e. a, b, c is (a, b), c

The expression with commas are not allowed in contexts where commas are used as delimiters, such as the parameter list or collection constructions, unless the expressions are enclosed in parenthesis.

Difference compared to previous revision

<span>It has the lowest precedence, below that of = operator. It is left associative, i.e. a, b, c is (a, b), c
===Restrictions===
The <span style="text-decoration:underline;color:green">expression with </span>=Operators=
==String Concatenation==
===Syntax===
...
It has the lowest precedence, below that of = operator. It is left associative, i.e. a, b, c is (a, b), c
===Restrictions===
The comma<span style="text-decoration:line-through;color:red"> operator</span>s are not allowed in contexts where <span style="text-decoration:line-through;color:red">a </span>commas are used as <span style="text-decoration:line-through;color:red">a </span>delimiters, such as the parameter list or collection constructions, unless the<span style="text-decoration:line-through;color:red"> comma</span> expressions are enclosed in parenthesis.
<span>

Please Confirm