• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL expressions as two-dimensional arrays

 
Alexander Kolesnikov
author
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"]}
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic