• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question in SCWCD mock exams to be discussed

 
Yahya El-Ganzoury
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Yahya El-Ganzoury
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tyler,

Tyler Wright wrote:

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

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


Yes, you are right.
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic