• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt on a question in EL

 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a doubt in EL.
Given:
<%java.util.Map map = new java.util.HashMap();
request.setAttribute("map",map);
map.put("a","b");
map.put("b","c");
map.put("c","d");%>
<%-- insert code here --%>

Which expression inserted will evaluate to "d"?


My doubt is how does one of the options $map{map[map.b]} evaluate to "d"?


Thanks in advance.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do not forget to quote your sources.
 
Ash More'
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
$map{map[map.b]} is not an EL expression at all. EL expressions start with ${. have you mistyped the question?
 
Prabhat Gupta
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess ${map.c} and ${map["c"]} will be evaluated as d.
 
What are you doing? You are supposed to be reading this 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!