File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q17, Pg 432, HFS

 
Nitish Bahadur
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Bharat Roy
Ranch Hand
Posts: 156
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
sundar katluri
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic