Global default expression/variable value policy

Ing. Jan Novotný <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Hello,

   I wonder whether there is a way how to set a default variable policy
globally in FreeMarker. Consider these cases, when myVar has null value:

1. ${myVar!""} <#-- prints empty string -->
2. ${myVar} <#-- throws exception -->

   This NULL treatment is very good for development and test environments,
but for production I'd like the second example to not throw exception but
instead print some default value (such as empty string). My experience is
that developers (webdesigners in my case) despite all the testing efforts
often "forget" to define default values even for non mandatory things. This
finally leads to errors in production that could be many times avoided if I
have chance to set a strategy how to behave when retrieving variable value
fails due to not specified default.

   Is there any extension point how can I plug in some custom logic for this
use case?

Thanks for any advices,
Jan

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
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.