I have something like this
<c:set var="x" value="a" />
Supposing I have a map like this
Map<String, String> map = new HashMap<>();
map.put("a", "1");
map.put("b", "2");
request.setAttribute("map", map);
I want to use variable ${x} as map key in an EL expression, like this
${map.x}
(which is wrong) in order to print
1
(or 2) depending on the value of ${x}
You need to use the brace notation
[]in order to use dynamic keys on aMap.See also: