tags:

views:

176

answers:

1

I know this works: <c:out value="${model.testhash['A']}"/>

but I need something like: <c:out value="${model.testhash[${model.testkey}]}"/>

Is this possible?

+1  A: 

Have you tried

${model.testhash[model.testkey]}

In general the ${ } only delineates the JSTL expression, you don't need to escape the lookup for the model.testkey lookup as well, so it is also possible to do:

${model.testhash[model.condition ? 'A' : 'B']}

.. just as an example.

beny23
Thanks! Just what I needed.
geff_chang