Since the 6.5.2 version of the Velocity implementation doesn’t allow the syntax for Map object creation, I had to write a work around.
This is the syntax that apache’s Velocity documentation says should work, but doesn’t:
#set( $myMap = {} )
This is the macro I built to work around:
## macro to create a new map object. This is a workaround to a bug in Rhythmyx's velocity implementation.
## Sam Rushing, Feb 3, 2010
#macro(newMap $obj)##
#set( $obj = "" )##
#set( $obj = $obj.getClass().forName("java.util.HashMap").newInstance() )##
#end
Following up, It is also possible to simply replace the velocity java archives with the latest from apache and you’ll open up lots of new functionality. The map object creation being only just 1 such new feature.
I haven’t checked CM System 6.7 yet, but in 6.5.2 I had velocity-1.4.jar and velocity-tools-1.3.jar.
I replaced these with velocity-1.5.jar and velocity-tools-view-1.4.jar.