Re: variable?? is not checking for null ... please help
Denis Bredelet <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Marc > Hi all; > > A little bit of a newbie with Freemarker, but according to the documentation > the following should work: > > <#assign result = mypackage.function()!> What is the "!" for here? Cheers, -- Denis. > <#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, > ------------------------------------------------------------------------------ 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/