wood burning stoves 2.0*
The moose likes JSP and the fly likes [ ] vs . Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "[ ] vs ." Watch "[ ] vs ." New topic
Author

[ ] vs .

Nicholas Carrier
Ranch Hand

Joined: Apr 14, 2005
Posts: 78
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.


Teaching yourself anything is always the cheapest way, but it definitely takes a lot of time and effort.<br /> <br />Thank you javaranch <a href="http://"http://faq.javaranch.com/view?HowToAskQuestionsOnJavaRanch"" target="_blank" rel="nofollow">Learn How to Ask Your Question</a> and be nice
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60802
    
  65



are all equivalent.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [ ] vs .
 
Similar Threads
Overriding Friendly Method With Public Modifier
EL and Exceptions, Clarification required
help me with this
Changing the class of an entity at some point of its life
confusion in <jsp:useBean>