Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL Doubt

 
Arunava Bhattacharya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hallo Everybody,

I have a small doubt.If person bean has a property dog which is in turn a bean and having a property name,is the following a valid way to access person's dog's name?

person["dog"]["name"]

also please mention other ways (except person.dog.name) to access the same.Just want to crosscheck.
 
samaya muduli
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Babun
Good Finding
This will work and will give you the same result as ${person.dog.name}
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hos is it that it works?? I mean how can we say person["dog"]["name"] is the same as person.dog.name???
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
person.name == person["name"]
We can replace the .(dot) with [""] (square bracket with quotes) and both will yield the same result..

Any suggestions..?
 
Arunava Bhattacharya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it is correct only.I have tried all the following combinations in tomcat and these are all valid.

person.name.dog
person["dog"].name
person["dog"]["name"]
person.dog["name"]
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the clarification offered!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic