• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

[ ] vs .

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is probably really simple, but I'm reading Head First: Servlet's and JSP and I understand how this works.

${person.dog.name}



Where there is an attribute of type person that has a property that is an object of type Dog that has a property that is a string which holds his name. In that case it's going to print out the person's dog's name.

What confuses me, and it's really just a side question, is how to do that with [].

This obviously doesn't work because it goes from inner most expression outwards.

${person[dog["name"]}



And prints out nothing because there is no property in the person object that has the same name as say Clifford.

Thanks for you help ahead of time. If I figure it out before anyone replies I'll post my own answer.
 
Sheriff
Posts: 67699
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


are all equivalent.
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic