Refactoring the velocity hack : Using  velocity proxy references instaed of Velocity servlet references in template engine. Add code in VelocityProxyImplementation to trigger custom code when a special method name is received as parameter.