Handling null objects

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