Hi all,
I am using
Tomcat 5.5 and
Servlet 2.4 specification. I am learning
J2EE basics from a book, "Pro JSP" from Apress edition. In this book, an example is given, which i am wondering ....how it works ?
The example is as follows: -
The authors want to say that, if in an EL expression you want to include
"$" and
"{" symbol....you need to escape it, and the example they gave is :-
In order to print =
${2 + 3} on the page...
the EL must be =
${'${'}2 + 3} I am not able to understand how does the EL suggested in the book works ...it does display the output as desired....but how ? ... Because, before reading the EL mentioned by the authors, i was thinking, how i would have written an EL to print
"${2 + 3}" on page!
I came up with following EL expressions which also give the same desired result: -
EL expression no. 1)
... here i have escaped the characters in the order they will appear from Left to Right in the
String literal
EL expression no. 2)
[CODE}
${"${2 + 3}"}
[/CODE]
... here in this EL, i thought since, i just want to PRINT text ....that is string literal on the page,...why not put all the characters in double quotes ?
....so all the three expression works....but how do they work ?...what is the exact processing done behind the scenes ? Which one is more correct and appropriate ?