This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question in SCWCD mock exams to be discussed 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 "Question in SCWCD mock exams to be discussed" Watch "Question in SCWCD mock exams to be discussed" New topic
Author

Question in SCWCD mock exams to be discussed

Yahya El-Ganzoury
Greenhorn

Joined: Jul 30, 2006
Posts: 6
111. given

11. com.example.Advisor advisor = new com.CodeRanch.Advisor();
12. request.setAttribute(“foo”, advisor);
Assuming there are no other “foo” attributes in the web application, which three are valid EL expressions for retrieving the advice property of advisor? (Choose three.)

#1. ${foo.advice}
#2. ${request.foo.advice}
#3. ${requestScope.foo.advice}
#4. ${requesstScope[foo[advice]]}
#5. ${requestScope[“foo”][advice]}
#6. ${requestScope[“foo”][@advice”]]}
what should be the answer?
For me, I see that it should be 1, 3, and 5.

Tyler Wright
Ranch Hand

Joined: Jun 25, 2009
Posts: 40
Hi Yahya,

Yes

I just coded this up and got that answers 1, 3, and 5 all worked...
However, I assumed that you meant to type:
#5. ${requestScope[“foo”]["advice"]} <-- this works

#5. ${requestScope[“foo”][advice]} <-- this DOES NOT work

regards,
Tyler


SCJP SCJD
Yahya El-Ganzoury
Greenhorn

Joined: Jul 30, 2006
Posts: 6
Hi Tyler,

Tyler Wright wrote:

#5. ${requestScope[“foo”]["advice"]} <-- this works

#5. ${requestScope[“foo”][advice]} <-- this DOES NOT work


Yes, you are right.
Thanks
 
GeeCON Prague 2014
 
subject: Question in SCWCD mock exams to be discussed