wood burning stoves 2.0*
The moose likes JSP and the fly likes String Operators in EL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "String Operators in EL" Watch "String Operators in EL" New topic

String Operators in EL

deepak adlakha
Ranch Hand

Joined: Jul 27, 2001
Posts: 325

EL code

Normal Scripting

OUTPUT :- 12

Can someone tell me why there is difference in output?... isn't it should be same
[ June 04, 2007: Message edited by: deepak adlakha ]
Christophe Verré

Joined: Nov 24, 2005
Posts: 14687


Really ? Did you mean ${"1"+2} ?
EL treats arithmetic operations as "arithmetic", not string concatenation. The rule is then different from Java.
With an addition, the container tries to convert both arguments into numbers, and sums them up.

[My Blog]
All roads lead to JavaRanch
deepak adlakha
Ranch Hand

Joined: Jul 27, 2001
Posts: 325
yup i meant ${"1"+2} only.

Thanks for explaination. But why it treats different as compare to java ?
Manoj Paul
Ranch Hand

Joined: Jan 18, 2007
Posts: 112
[Thread hijack removed]
[ June 04, 2007: Message edited by: Bear Bibeault ]
It is sorta covered in the JavaRanch Style Guide.
subject: String Operators in EL
Similar Threads
including webpage in jsp
EL question
EL expression
simple q but just to confirm
EL expressions