The archives are littered with snippets of wisdom that are not captured in the User or Developer guides. Find something that isn't in the manual, and folks ask a lot on the list? Please, add it here. Eventually, the info may move into the offical guides. If you have a specific question that is not answered here or in the mailing list archives, then ask please the user list.

Velocity





Here is a solution provided by Shinobu Kawai:

#foreach($key in $myMap.keySet())
 #set($value = $myMap.get($key))
 $key = $value
#end

or you can do

#foreach($entry in $myMap.entrySet())
 $entry.key = $entry.value
#end


#if ($car.fuel == null)




If none of these tweaks work for you here are a few more tips:

Remember, Velocity doesn't compile your templates. They are parsed into an AST (abstract syntax tree) and that is what gets cached. So, reducing template complexity will shrink the tree and produce immediate memory savings. For loops and (java) "tools" are simpler than velocimacros. (Nathan Bubna & Bruno Carle)


Velocity Tools




DVSL & Anakia & Texen & Misc

VelocityFAQ (last edited 2011-06-10 14:31:14 by NathanBubna)