You can't nest EL expressions like that.
You can achieve the concrete functional requirement only if you know the scope of those variables beforehand. This way you can use the brace notation while accessing the scope map directly. You can use <c:set>
to create a new string variable in EL scope composed of multiple variables. You can use e.g. ${requestScope}
to access the mapping of request scoped variables.
Thus, provided that you've indeed stored those variables in the request scope, then this should do:
<c:forEach begin="1" end="3" var="i">
<c:set var="image" value="image${i}" />
${requestScope[image]}
</c:forEach>
For the session scope, use the ${sessionScope}
map instead.
See also:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…