• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting map values using EL in JSP

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic