• 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
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!