• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Errata on HF question?

Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

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 ]
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic