Using freemarker, is there any way to reference a value indirectly along the lines of...
<#assign apple=fruit>
<#assign item=apple>
开发者_运维技巧${${item}}
to produce the output 'fruit' without prior knowledge of what value item might contain?
You can try using eval built-in:
${item?eval}
That would only work if item
contains a valid expression, though. There's also an interpret
built-in which treats your string as a full template, I haven't used it myself.
精彩评论