jQuery in Action, 3rd edition
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes EL expressions as two-dimensional arrays 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 expressions as two-dimensional arrays" Watch "EL expressions as two-dimensional arrays" New topic

EL expressions as two-dimensional arrays

Alexander Kolesnikov
Ranch Hand

Joined: Feb 26, 2005
Posts: 99
Just managed to recall one of the EL features which I've met on the real exam but didn't read about it anywhere before. An EL expression which looks like a two-dimentional array.

This is not the real question, but an attempt to imitate its logic.

Say, you have a map named foo which contains a key "zoo" and the corresponding value "blabla". You are passing this map as a request attribute. Which EL expression you can use to output "blabla"?

One of the variants could look like this: ${requestScope["foo"]["zoo"]}

Alexander Kolesnikov<br />Java Web Developer<br />SCJP 1.4, SCWCD 1.4, SCBCD 1.3<br /><a href="http://sundraw.ws" target="_blank" rel="nofollow">Tapestry 5: Building Web Applications</a><br /><a href="http://sundraw.ws/batik.jsp" target="_blank" rel="nofollow">Java Drawing With Apache Batik</a>
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 951

I think it is not arrarys. It is EL [] operators, with no similarities with arrays. In the given example I think it access the zoo property correctly.

It is roughly equivalent to :
${RequestScope.foo.zoo} should give the desired output.


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
I agree. Here's the link: http://aspose.com/file-tools
subject: EL expressions as two-dimensional arrays
It's not a secret anymore!