Pergunta

Basically, I'm trying to do this: ${ ${var} }.

I have the following:

<c:set var="x1" value="value1"/>
<c:set var="value1" value="x2"/>

My goal is to use x1 to get x2. At runtime, I do not know value1. So, my first guess is that ${ ${x1} } = ${ value1 } = x2. However, this does not work. How do I accomplish this task? Thanks

Foi útil?

Solução

I have a hard time understanding why and when this should be useful, but I think ${pageScope[x1]} should work.

${} means interpret the JSP EL expression inside the curly braces. And ${} is not a JSP EL operator, so it can't be used inside ${}.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top