This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes question on EL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "question on EL" Watch "question on EL" New topic

question on EL

Heilien Tsui

Joined: Dec 08, 2008
Posts: 20
I am having problem on this question. partly because, i do not understand the question.

What is the question trying to describe ?

[Thumbnail for question.jpg]

Ankit Garg

Joined: Aug 03, 2008
Posts: 9291

I think the question is fairly simple (wow I am weak at EL and still I got it ). The question is saying that there is instance of a class named Appliance in the application scope with the name - appl. Now that class has a map of properties. Now the question is not clear on the point that the name of the map is properties. So the Appliance class would look like this

So now when we write the EL


here appl refers to the instance of Appliance class, properties will get the properties map, in the map the question says that there is a key named "name" which has the value Cobia which is what we want to display.

In the second example, we use a request scoped attribute prop to get the name property. You must know that there are two ways of accessing a property of a map. So if we want, we could have written the above EL as


Now here we have used a string name to refer to the key in the properties map. But if you remove the quotes, then the value in the square brackets will get evaluated. And we know that there is a request attribute named prop containing the value name. So we write this EL


So this EL will be first evaluated to


and then the final value will get displayed...

[Edit: spelling correction]

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Heilien Tsui

Joined: Dec 08, 2008
Posts: 20
Thanks Ankit, a very detail explanation
It is sorta covered in the JavaRanch Style Guide.
subject: question on EL
Similar Threads
Doubt on EL
byte range...
I Was Unable To Do The Drag and Drop Question At The Exam
fname ???
this below gives well in which case this gives