• 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 ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Q17, Pg 432, HFS

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Q. Which about EL access operators are true?
C. If the .(dot) operator is used to access a bean property but the property doesn't exist, then a runtime exception is thrown.

Can someone just validate this one?
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer is WRONG. Check out errata.

If the property doesn't exist, it gives no o/p.
[ February 03, 2005: Message edited by: Ankur Bhatt ]
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if the bean exist and property does not exist -- throws run time exception (at least in tomcat). I have seen several posts in this forum that says the above statement is correct and errata is wrong.
I am confused now !! which is one is right?I greatly appreciate HFS authors if they could clarify this doubt


Thanks
 
Nitish Bahadur
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ankur,

Try creating a Person class with just firstName property, but in the EL access lastName, which does not exist in your class definition. What do you see?

Additionally, please refer to JSP 2.3.4 last paragraph of JSP 2.0 Specification.

Can I assume the errata is wrong?

~Cheers
 
Bharat Roy
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nitish Bahadur:
Ankur,

Try creating a Person class with just firstName property, but in the EL access lastName, which does not exist in your class definition. What do you see?

Additionally, please refer to JSP 2.3.4 last paragraph of JSP 2.0 Specification.

Can I assume the errata is wrong?

~Cheers


Oh boy, it threw an exception. Errata IS wrong!! I am concuding that if the left side of dot in an EL is Map then it will not throw an exception but if its bean it will.

Guess book needs errata's errata
 
We begin by testing your absorbancy by exposing you to this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic