• Post Reply Bookmark Topic Watch Topic
  • New Topic

EL Expressions

 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In HFS Page 366, the following EL Expression
${person.dog.name}

how do we write the above with [] operator
${person[dog["name"]]} ??, I got blank when I used this....
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can write it coz the "." (dot operator) can be equivalently replace by a [] (Array operator).

u can do a bit google using this search string -

"EL equivalence between . and [] operator"
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try this .

${person["dog"]["name"]}

Thanks
 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try

${person["dog"].name}
${person.dog["name"]}
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!