File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes EL doubt? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "EL doubt?" Watch "EL doubt?" New topic
Author

EL doubt?

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9426
    
    2

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, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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: 9426
    
    2

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: 14688
    
  16

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EL doubt?