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.
Velocity is a Java-based templating engine. It's an open source web framework designed to be used as a view component in the MVC architecture, and it provides an alternative to some existing technologies such as JSP. Velocity can be used to generate XML files, SQL, PostScript and most other text-based formats.
Velocity templates were deprecated in Liferay Portal 7.0 and are now removed in favor of FreeMarker templates in Liferay DXP 7.2.
To use, either add this pair of macros to your template, or better yet, to your VM_Global_library. vm file. Then from the template you want to debug, you can simply add #showDebugPopup() to the bottom of the template you want to debug, and it will pop up a window with debugging information.
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/configuration.html
You can register an event handler which tells Velocity to throw an exception on an undefined reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With