I noticed that my spring macros stopped working. I narrowed down the cause to a version of velocity tools. Just changing what version of velocity tools made the difference. So what changed between 2.0-beta1 and 2.0-beta2 to cause the failure? I assume I'm not the only one on the list using Spring MVC with velocity.

Here are the maven pom changes to switch between working and failing versions.
WORKS:
   <dependency>
     <groupId>velocity-tools</groupId>
     <artifactId>velocity-tools</artifactId>
     <version>2.0-beta1</version>
   </dependency>

FAILS:
   <dependency>
     <groupId>org.apache.velocity</groupId>
     <artifactId>velocity-tools</artifactId>
     <version>2.0-beta3</version><!-- 2.0-beta2 also fails -->
   </dependency>

The version of spring MVC used was 2.5.5 or 2.5.6

Here is the code snippet:

#macro(collectionAsList $name $collection)
<b>$name</b><br/>
<ol>
 #foreach($element in $collection)
   <li>$element</li>
 #end
</ol>
#end

#macro(evalFieldList $evalVar $fieldList)
<ul>
#foreach($evalField in $fieldList)
   <li> $evalField => $render.eval("${evalVar}.$evalField") </li>
#end </ul> #end

<b>springMacroRequestContext ($springMacroRequestContext.class)</b>
#set($requestContextFields = ['contextPath', 'isDefaultHtmlEscape()', 'locale', 'queryString',
   'requestUri', 'theme.name', 'webApplicationContext'])
#evalFieldList('$springMacroRequestContext', $requestContextFields)

Let me know if you need anything more.

Paul Sundling


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to