I\'m trying to do something that seems like it should be relatively straightforward and running into a bit of a wall.
Let\'s say I\'ve got a list of products which
You can by using implicit objects:
There are objects that allow access to the various scoped variables described in Using Scope Objects.
When an expression references one of these objects by name, the appropriate object is returned instead of the corresponding attribute. For example, ${pageContext} returns the PageContext object, even if there is an existing pageContext attribute containing some other value.
- pageScope: Maps page-scoped variable names to their values
- requestScope: Maps request-scoped variable names to their values
- sessionScope: Maps session-scoped variable names to their values
- applicationScope: Maps application-scoped variable names to their values
So, for example:
<c:set var="selectedProductAttrName" value="selectedProduct_${product.id}"/>
${requestScope[selectedProductAttrName]}