There is no one-stop solution for this, but you can try
<#list .data_model?keys as key> ${key} </#list>
This works if the data model is a regular Map or JavaBean, but for more complex data models this applies to the implementation of the data model, if it supports ?keys , and if it really returns everything.
You also have variables that you set in the templates, which can be listed as above, instead of .data_model use .globals , .namespace (which means the current template namespace) and .locals .
You can also have shared Configuration -level variables, and there is no way to list them only from FTL (you can write a custom TemplateMethodModel for it that reads Configuration.getSharedVariableNames() , although it calls it from the template).
Of course, ideally, FreeMarker should have a directive <#show_variables> or something else that does everything possible to show all this ... but, unfortunately, this is not yet.
ddekany
source share