marcusadamski
2012-08-06 22:55:19 UTC
Hi all;
A little bit of a newbie with Freemarker, but according to the documentation
the following should work:
<#assign result = mypackage.function()!>
<#if result??>
result.function()
.... do stuff, when result is NOT NULL
where mypackage.function has been passed into the Freemarker template before
processing.
I know the mypackage,function works, and passes back valid objects. However,
when the Java function returns a null, the <#if result??> allows the null to
pass - causing a problem when I try to access result.function()
Can somebody please, explain why the above <#if> doesn't catch a null (and I
know a null is being passed in, due to logging).
Many thanks for any feedback,
Marc
--
View this message in context: http://freemarker.624813.n4.nabble.com/variable-is-not-checking-for-null-please-help-tp4654193.html
Sent from the freemarker-user mailing list archive at Nabble.com.
A little bit of a newbie with Freemarker, but according to the documentation
the following should work:
<#assign result = mypackage.function()!>
<#if result??>
result.function()
.... do stuff, when result is NOT NULL
where mypackage.function has been passed into the Freemarker template before
processing.
I know the mypackage,function works, and passes back valid objects. However,
when the Java function returns a null, the <#if result??> allows the null to
pass - causing a problem when I try to access result.function()
Can somebody please, explain why the above <#if> doesn't catch a null (and I
know a null is being passed in, due to logging).
Many thanks for any feedback,
Marc
--
View this message in context: http://freemarker.624813.n4.nabble.com/variable-is-not-checking-for-null-please-help-tp4654193.html
Sent from the freemarker-user mailing list archive at Nabble.com.