Re: Handling null objects
"Stoehr Sukachevin" <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
See http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_missing_test for the answer... -- Stoehr Stoehr Sukáchevin Chief Software Architect, Product Engineering Plateau Systems Ltd. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of mateamargo Sent: Friday, April 04, 2008 13:54 PM To: [email protected] Subject: [FreeMarker-user] Handling null objects I haven't found in the doc how to handle the null objects. 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> New User <#else> Editing <em>${user.name}</em> </#if> But I get this error: Expression null is undefined How should I evaluate that object? -- View this message in context: http://www.nabble.com/Handling-null-objects-tp16494452p16494452.html Sent from the freemarker-user mailing list archive at Nabble.com. ------------------------------------------------------------------------- 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 _______________________________________________ FreeMarker-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freemarker-user . The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. This message is privileged and confidential. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. ------------------------------------------------------------------------- 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