This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt in Mock question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubt in Mock question" Watch "Doubt in Mock question" New topic
Author

Doubt in Mock question

Gurukant Desai
Ranch Hand

Joined: Apr 07, 2008
Posts: 56
Hi,
I found this question in Marcus Green's mock exam paper-1.

52. Given a JSP page with the following code, which of the following options would result in the output of red?

<%
java.util.HashMap hm = new java.util.HashMap();
hm.put("apple","red");
request.setAttribute("apple",hm);
%>Choose at least one answer.
a. ${apple.["apple"]}
b. ${apple.apple}
c. ${apple["apple"]}
d. ${apple['apple']}

Correct answers given are b,c and d.
I have a doubt, whether requestScope's attribute "apple" can be accessed directly by name?
I think this question is wrong. Please confirm.

[ May 06, 2008: Message edited by: Gurukant Desai ]
[ May 06, 2008: Message edited by: Gurukant Desai ]
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
What do you mean by : can be accessed directly by name?

You are already using its name to access it!

Please explain the meaning of your question.

Regards,


Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
Kumar Garlapati
Ranch Hand

Joined: Feb 04, 2008
Posts: 38


There is nothing wrong in the question, its absolutely correct.
we can access all scope attributes directly.



all the above can access directly using b,c and d options.


Regards,<br />Kumar
Gurukant Desai
Ranch Hand

Joined: Apr 07, 2008
Posts: 56
Thanks a lot for the reply....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in Mock question