tags:

views:

94

answers:

1

Hi,

in EL expression in JSP we can use ${"1"+"2"} but not ${"Dark"+"Knight"}. Why?

+10  A: 

The JSP 2.1 (2006) spec defines + as an arithmetic operator only, so it cannot be used for string concatenation. "1" and "2" are coerced to numerical types according to the rules for coercion, so ${"1"+"2"} will evaluate to 3.

McDowell
You're truly amazing, Mr. McDowell!
Dusk