| Author |
EL doubt?
|
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
Guys, in the following code how do we get the o/p EL in either syntax? What happens in the background when we hit the EL and how the o/p is evaluated? <html> <head><title>As a normal JSP</title></head> <body> <% request.setAttribute("whichever", "EL in either syntax"); %> <p>${whichever}</p> </body></html>
|
SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
|
|
|
This expression will look for the attribute named whichever, searching the page, request, session, and application scopes, and will return its value. If the attribute is not found, null is returned.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
|
So it will do a pageContext.findAttribute(). Now what if I'm not trying to display any attribute but rather just a text?
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
|
|
I'm not a container provider, but I'd say that it looks for a String and just prints it. String -With single and double quotes - " is escaped as \", ' is escaped as \', and \ is escaped as \\. Quotes only need to be escaped in a string value enclosed in the same type of quote
|
 |
 |
|
|
subject: EL doubt?
|
|
|