Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EL question

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I have a small question on EL. What would be the difference in using sample["text"] and sample[text]? What difference would the "" make?
 
Abhishek Pratap
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

the difference would be...

using "" it will look as a key of map or bean property or ArrayList or Array String compatible index.

But when you don't use "" it looks for the attributes in scope directly not as a property of attribute.

for example map["test"] will look for key inside a map but map[test] will first replace the value of test from scope attribute and then that value is used as a key for map for retrieving the result...

hope you understand this....


Regards,
Abhishek
SCJP 5.0 90%
SCWCD1.4 in progress
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, got it...thanks!
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
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!