Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bean property

 
Stella Kim
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the HF book on page 424, the mock exams # 17,
c) If the .(dot) operator is used to access a bean property but the property doesn't exist, then runtime exception is thrown. -- the book says it's true.

HF book on page 447 says that "EL expression itself will NOT cause an exception if the property doesn't exist."

Anyone can tell me Which statment is true ?
Please..
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have HFSJ so can't say anything what is written in that. However, i can understand following from this:



Consider the above code and now try to access the property of person bean using EL like ${person.name}. It will work fine, however if you write ${person.noProperty}, it will throw exception as noProperty doesn't exist in Person class. Note that here you are accessing property with "." operator.

Similarly if you try to write ${noproperty} in your jsp and this variable doesn't exist in any scope then EL will not cause any exception.

Hope it helps
[ January 21, 2007: Message edited by: Ali Gohar ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic