• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dot operator

 
amarkirt saroay
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the dot(.) operator is used to access a bean property but the property does not exist ,then a runtime exception is thrown . Is this statement correct?
 
Tripati Sahu
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please provide an example???
 
amarkirt saroay
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example:

If there is a bean named customer and it has only one property say name but it does not have a property say age.
So ,
Will this EL throw a runtime exception?: ${customer.age} or ${customer["age"]}
 
Mateus Lucio
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, an EL Exception will be thrown!

Since it's a bean object ${customer.age} it's like customer.getAge() but that method does not exists.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic