I am trying to avoid repeatedly refering to objects like this:
${outter.inner.assignThisGuy.field1}
and would like to refer to lowest level, i.e.
${assignThisGuy.field1}
This will help me remove repeated null checks and make my template tidier. I'm not sure if this is possible. All the notes refer to assigning a variable to a type like ?string, ?date, etc.
When I try to do it I get an exception:
freemarker.template.TemplateException: Expected hash. thisGuy evaluated instead to freemarker.template.SimpleScalar
I have tried variations on:
[#assign thisGuy = "${outter.inner.assignThisGuy}" ]
I just want to be sure this is not possible before some of my lines become massive in length!
It is possible, like this:
<#assign thisGuy = outter.inner.assignThisGuy>
...
${thisGuy.field1}
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