Hi all,
2 questions :
In chapter 8's mock exam, there are 2 questions for which I didnt quite get the answers...I was wondering if it is a typo else can someone please explain how it works..
Question 6:
<%java.util.List list = new java.util.ArrayList();
list.add("a");
list.add("2");
list.add("c");
request.setAttribute("list", list);
request.setAttribute("listIdx","1");
%>
<%insert code here%>
which inserted lines below are valid and evaluate to c
possible answers:
a. ${list.2}
b. ${list[2]}
c. ${list.listIdx+1}
d. ${list[listIdx+1]}
e. ${list['listIdx'+1]}
f. ${list[list['listIdx']]}
I understand how
b.${list[2]} and d.${lost[lisId+1]} can be answers to this question...
but not how f ${list[list['listIdx']]} can be a possible answer
does this indicate that 'listIdx' in ${list[list['listIdx']]} is transformed to listIdx and the attribute list is searched for listIdx?
Also question 17.
Which about the EL access operators are true.
C. If the . dot operator is used to access a bean property but the property doesnt exist, then a runtime exception is thrown.
This has been marked as true but it is mentioned in the book that EL expressions handle nulls well and will not throw an exception.
So is C also a valid choice ?
Also, where can I find the errata for the Head First
Servlets and
JSP Thanks,
Roger