• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting map values using EL in JSP  RSS feed

 
Kumar Jaya
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a utility class ContextObject which has a java.util.Map instance variable with a getter method for it. I have placed the ContextObject in Application Scope using the EL

I am adding a value to the Map in ContextObject using the EL

I just want to retrieve the value and print in the same page. I used the EL expression

and

But both does not seem to work. I think I cant use an EL expression within an EL expression? Is there a way to get the value fro the map?
Thanks in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66158
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you need to? The whole thing is an EL expression. You are perhaps thinking that ${} is some sort of fetch operator? if so, that's wrong. The ${} simply encompasses the entire complex EL expression.
 
Kumar Jaya
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Why would you need to? The whole thing is an EL expression. You are perhaps thinking that ${} is some sort of fetch operator? if so, that's wrong. The ${} simply encompasses the entire complex EL expression.


May be


this is what you mean! But the value of request time variable "pageContext.request.remoteAddr" is the key to the required value in the map. So I am fetching the parameter using ${pageContext.request.remoteAddr}.

I have add a map entry using the key ${pageContext.request.remoteAddr}, so how will I retrieve the value back from the map?

 
Kumar Jaya
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear, I got it to work, I just thought that I needed a new EL within EL to pass a parameter to the enclosing EL!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!