Question

I have defined a variable in a FTL template using assign that I would like to be accessible after the template was processed via eg used context map.

How?

Was it helpful?

Solution

See in the FAQ: http://freemarker.org/docs/app_faq.html#faq_retrieve_calculated_values

Environment env = myTemplate.createProcessingEnvironment(root, out);
env.process();  // process the template
TemplateModel x = env.getVariable("x");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top