Can Velocity be configure to fail (i.e. throw an Exception) when a $var is undefined.
Such a "fail-fast" strategy would help in our testing cycles.
Can Velocity be configure to fail (i.e. throw an Exception) when a $var is undefined.
Such a "fail-fast" strategy would help in our testing cycles.
You can register an event handler which tells Velocity to throw an exception on an undefined reference
You could switch to FreeMarker. It throws exceptions on missing fields, and, invalid types.
Not only that the exceptions thron are precise and readable. ' Missing field FOO at line 234 in BAR.ftl ' etc. etc.
I would absolutly recommend Freemarker over any other templating system.
In Velocity 1.6 you can add the following property to your velocity.properties
runtime.references.strict = true
Edit: Full list of configuration is available here: http://velocity.apache.org/engine/devel/developer-guide.html#Velocity%5FConfiguration%5FKeys%5Fand%5FValues