Forums Register Login

Doubt in Mock question

+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
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,
+Pie Number of slices to send: Send


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.
+Pie Number of slices to send: Send
Thanks a lot for the reply....
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 701 times.
Similar Threads
doubt about constraints of WEB-INF folder
Problem in Mock exam
Dought for EL in one mock exam its urgent
Generic doubt
Doubt in EL operator
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:17:52.