Can freemarker interpolation contain interpolation?

Let's say I have a Freemarker A variable, which, for example, contains the name of another variable in the hash tree. "B." I would like to use a to read the value of B, for example, if B contained "C", I could tell Freemarker about the release of C using A: ${${A}} should lead to the output of "C". Naturally, this does not work in the FreeMarker, but is there a way to do this?

+3
source share
1 answer

Use the special variable .vars, which is the hash (map) of the variables, and therefore you can use the aHash [aKeyExpression] syntax:

${.vars[A]}

via Daniel Deccany, author and accompanying documentation

+2
source

Source: https://habr.com/ru/post/1741348/


All Articles