I am trying to execute freemarker code within a freemarker ftl, I explain a little what I have:
We have a module with Spring that solves the FTL views and prints its content, even here everything works perfectly, but sometimes we will want to introduce more code in that view and we need to do it without having to deploy the module again, that is why we are entering Freemarker code in a String variable and passing that variable to the view through the model. But the problem appears here, I don't know how to manage that variable, the most I can do is paint it $ {myVar}, but the Freemakrer code appears as if it were a simple HTMl (that is, Freemarker does not execute it as such).
Is there a way to do a kind of include with that variable that has Freemarker code?
We do something alike with dymanic parts in a view. You can use interpret
and <@var>
to achieve that. Something like
<#assign varTempl = myVar?interpret >
<@varTempl />
The first line will parse your template, the second line will print it.