WebMacro 2 Java Templating Language released
After some hard work by WebMacro stalwart Lane Sharman, WebMacro 2 is finally publicly released.
WebMacro 2 has been at RC status for a very long time and is incredibly stable. This final release fixes a couple of bugs and formalizes the robustness of the code base, and Lane has added tons of unit tests and refined the build processes. My JSP and Spring integration for WM has not made it into this release due to work pressures but hopefully we’ll get a 2.1 cut very soon with that stuff in it.
New in WebMacro 2 is native support for map variable types using a simple syntax:
#set $myMap = { "key1" : "value1", "key2" : $someValue2 }
This is of course very useful, especially when you need to collate some data in the view layer. I used this feature extensively recently in a client project to render statistics served remotely as XML to HTML. This required sorting on certain columns and rows, and I pre-collated the information into maps to make this task easier – indexing from sorted lists into the map. I also used the maps to cleanly pass collections of parameters between included templates to avoid polluting global scope.
It’s been there a long time now but WM 2 also introduces some major improvements in the Context Tool mechanism. These are tools that are only instantiated per-request on demand, i.e. pages that do not need them do not create the instance of the tool. The new Context Tool Loader mechanism allows you to supply custom context loaders to create these objects on demand at runtime. There’s also the delegating template loader stuff that allows you to plug in "stacked" protocol-based template loading mechanisms so it is really easy to change where your templates are loaded from now.
There’s a whole lot more in there but it’s hard to remember what changed since 1.0 because 2.0 has been around in RC for so long!
Thanks to Lane for putting in the time on this. I’m looking forwarding to using it in my the new version of Ignition, my web framework.




















