variable?? is not checking for null ... please help

marcusadamski <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
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.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.