jsr341-experts@el-spec.java.net

[jsr341-experts] concat and assign operators

From: Kin-man Chung <kinman.chung_at_oracle.com>
Date: Fri, 26 Aug 2011 15:53:37 -0700

I've written something for the concatenation and assignment operators in
the wiki

     http://java.net/projects/el-spec/pages/Operators.

These two are important operators that were somehow omitted in the
current EL. I'd like to include them in this JSR, since they are
obviously needed, especially in a stand-alone environment.

It is hard to imagine an expression language without a concatenation
operator. The current EL gets by with composite expressions. But
composite expressions are restricted to the root level expressions (for
instance, it cannot be used as method arguments). Moreover, with
automatic bracketing of expressions, concatenation operator is a must.

I've pick # as the concatenation operator. I wish I can use +, but I
can't, because it is an arithmetic add, even for string operands.

Currently it is not easy to set a value to a variable (scoped variable
in a web container), a bean property, or map entry. You'll have to
parse the expressions such as #{bean.prop} and call the setValue method
on the resultant ValueExpression. Even so you can only set a Java
expression, and not an EL expression.

Our propose ELProcessor.setVariable() can be useful, but it can only set
to a variable.

The JSTL tag handler c:set is powerful but is obviously not appropriate
in an stand-alone environment.

Comments?

Kin-man