I'm attempting to dump all the variables available to my freemarker templates. I'm attempting to use something like:
<#list .vars?keys as prop>
${prop} = ${.vars.get(prop)}
</#list>
I read in the documentation that .vars doesn't support the keys functionality however I'm using the above to show what I'm trying to do.
This is my first day with Freemarker so any advice would be great.
I don't think you can list all the variables available to the template. I know you can't list them in Java.
FreeMarker is very well documented. Check out the part on special variables in FreeMarker.
If it's any consolation, you can access the local variables,
<#assign someVar = 12>
<#list .main?keys as var>
${var}
</#list>
which outputs
someVar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With