Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL question

 
Joe Harry
Ranch Hand
Posts: 10084
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: 10084
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, got it...thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic