Two Laptop Bag*
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "EL question" Watch "EL question" New topic
Author

EL question

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9353
    
    2

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?


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

Joined: Sep 26, 2006
Posts: 9353
    
    2

Yes, got it...thanks!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: EL question