velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <>
Subject Re: conditional operator - Macro Format Mystery Solved
Date Fri, 11 May 2001 11:49:23 GMT
David Duddleston wrote:
> Ahhh... in my first attempt to use a macro, I did not realize the macro was
> sort of cached. Figured out that I need to reload the Servlet to use a new
> macro with the same name. Anyway when I changed this macro
> #macro( bgc $count )
> #if( $count%2==0 )
> #66CCFF#else
> #EEEEEE#end
> #end
> to this
> #macro( bgc $count )
> #if( $count%2==0 )#66CCFF#else#EEEEEE#end
> #end
> and reloaded the Servlet... it took the new format. Now I'll have to see if
> there is a property regarding macro being cached.

Yes, the default setting is that a global macro is protected from being

TO change this, set the property  to true


velocimacro.permissions.allow.inline.local.scope  ->  true

should prevent your macros from becoming 'global' in the first place.

To set these, and you are using the default mechanism in
VelocityServlet, just add them to your properties file, or do it
directly, a la

Boolean.TRUE );

in the right place.  Where 'the right place' is depends on your
initialization strategy.  Lately, out of sheer lazyness, I have been
overriding loadConfiguration(), and doing the entire setup of the
runtime engine in there, calling Velocity.init() to make sure it's
done.  The servlet init() will subsequently try to set properties and
call init, but since I have already init()-ed, it's done.

I guess we should add a little initVelocity() method call that you can


Geir Magnusson Jr.                 
System and Software Consulting
Developing for the web?  See
"still climbing up to the shoulders..."

View raw message