Hi guys (I'm using the term 'guys' not in the gender way

. I've already checked on the errata for this question but I couldn't find anything. Here's the question (which you can find on page 423 of HFJSP).
Given the following class:
Which will cause errors, assuming that an attribute named "mybean" of type MyBean can be found?
a) ${mybean.name}
b) ${mybean["name"]}
c) ${mybean.objects.a}
d) ${mybean["params"].a}
e) ${mybean.params["a"]}
f) ${mybean["objects"].a}
The book give as answers C and F, because objects in not a Map and a lookup will not be performed. However, I'm trying with
Tomcat 5.4 and in any of the above cases I don't get an exception. However, if I add something like ${mybean["trallalla"]}, I get the following exception:
[list-start]
javax.servlet.ServletException: Unable to find a value for "trallala" in object of class "org.jemos.certs.vo.MyBean" using operator "[]"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:845)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:778)
org.apache.jsp.elFunction_jsp._jspService(org.apache.jsp.elFunction_jsp:74)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
[list-end]
This is the
java class that I wrote:
and this is the
JSP page:
Now, is it Tomcat too smart, so it doesn't produce an error even when it should, or is there an errata for this question?
Thanks for any help,
[ January 23, 2005: Message edited by: Marco Tedone ]