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 ]
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 ]