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 Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Errata on HF question?" Watch "Errata on HF question?" New topic
Author

Errata on HF question?

alzamabar
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) ${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 ]

Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
alzamabar
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.

Marco
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Errata on HF question?