Hello Experts,
I have problem that seems to be rather trivial but I was not able to solve it. In my Velocity-Templates I have a variable $contentFormDb
that has been populated with Content from the Database (In the Controller of the MVC App). This Variable will not only contain literal Strings but also further Velocity Directives (like " #set($test = "test) $test"
, see example below).
If I use $contentFromDB
in my templates, Velocity prints the contents into my Template in a "Literal way". For example if the Variable $contentFromDB
contains the String " #set($test = "test) $test"
(this has been set in the Controller) I will eny up with the literal output #set($test = "test) $test
in my velocity template rathern just test
.
I need something like the #parse()
directive that I can give my variable $contentFromDB
and that then will evaluate the variable. #parse($contentFormDb)
But #parse()
only accepts files to be evaluated/parsed.
Maybe I am missunderstanding here something completely... But how to solve this problem this seems to me being a standard use-case having content from the DB that then also needs to be evaluated in the template...
Thank you very much!! Jan