jQuery in Action, 3rd edition
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes EL question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "EL question" Watch "EL question" New topic

EL question

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032


I have a small question on EL. What would be the difference in using sample["text"] and sample[text]? What difference would the "" make?

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Abhishek Pratap
Ranch Hand

Joined: Apr 14, 2006
Posts: 43

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....

SCJP 5.0 90%
SCWCD1.4 in progress
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032

Yes, got it...thanks!
I agree. Here's the link: http://aspose.com/file-tools
subject: EL question
It's not a secret anymore!