Re: Handling null objects
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Friday, April 4, 2008, 10:45:23 PM, Daniel Dekany wrote: > Friday, April 4, 2008, 7:53:48 PM, mateamargo wrote: > >> I haven't found in the doc how to handle the null objects. > > The Manual says that a variable whose value us null "IS null" > and missing > variable is the same under FreeMarker 2.3.x. (This will be different > in FreeMarker 2.4, however, where if you want to, you can tell the > difference.) > >> I load from the database a user by its id, but it may happen that doesn't >> exist. In that case, the "user" variable will be null. >> >> I wanted to evaluate it in a if: >> >> <#if user == null> > > That should be: <#if user??> Sorry... mean to be: <#if !user??> > This means "if the user variable doesn't exist". [snip] -- Best regards, Daniel Dekany ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace