I'm not sure what's going on here.  How are you configuring your
tools?  How are you processing the templates?  If
$springMacroRequestContext.class has no value, that means that
$springMacroRequestContext is not in the velocity context being merged
with the template.  I can't recall any difference between beta1 and
beta2 that would change that, but i wouldn't rule it out as there were
plenty of changes.  Still, without knowing more about how you have
Velocity, VelocityTools and Spring MVC configured to interact, it is
hard to know why you aren't getting that object in your context
anymore.

On Mon, Jan 5, 2009 at 2:17 AM, Paul Sundling (Webdaddy) <[email protected]> wrote:
> Just to clear up what the code does, Here is a simpler version of the
> template.  It basically uses the spring macro context that is stored with
> Spring MVC and outputs the variables.  With velocity tools 2.0-beta1, you
> get the actual answers like the locale.  With velocity tools 2.0-beta2  or
> 3, you get just the variable name like $springMacroRequestContext.class,
> meaning there is no value (which would be blank if I had
> $!springMacroRequestContext.class instead...)
>
> <ul>
>  <li>class => $springMacroRequestContext.class  </li>
>  <li>contextPath => $springMacroRequestContext.contextPath  </li>
>  <li>isDefaultHtmlEscape => $springMacroRequestContext.isDefaultHtmlEscape
>  </li>
>  <li>locale => $springMacroRequestContext.locale  </li>
>  <li>queryString => $springMacroRequestContext.queryString  </li>
>  <li>requestUri => $springMacroRequestContext.requestUri  </li>
>  <li>theme.name => $springMacroRequestContext.theme.name  </li>
>  <li>webApplicationContext =>
> $springMacroRequestContext.webApplicationContext  </li>
> </ul>
>
> Paul Sundling
>
> Paul Sundling (Webdaddy) wrote:
>>
>> 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]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

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

Reply via email to