aspose file tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Errata on HF question? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Errata on HF question?" Watch "Errata on HF question?" New topic

Errata on HF question?

Ranch Hand

Joined: Jul 24, 2002
Posts: 379
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) ${}
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:

javax.servlet.ServletException: Unable to find a value for "trallala" in object of class "org.jemos.certs.vo.MyBean" using operator "[]"


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 ]

Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
Ranch Hand

Joined: Jul 24, 2002
Posts: 379
I found that the problem was due to Tomcat 5.5 and not to the HF. With Tomcat 5.0 the container throws an exception.

Don't get me started about those stupid light bulbs.
subject: Errata on HF question?