Using the VelocityTemplating Control

VelocityTemplating Control provides a simple java interface VelocityTemplatingEngine. The interface is mentioned below.
java.lang.String evaluate(java.lang.String template, java.util.Map context) throws java.lang.Exception;

Input Parameter

VelocityTemplatingEngine interface takes only two parameters, velocity template as string and context as Map. You can find more information about Velocity templates here.
java.lang.String template
Velocity template as String. This cannot be null. e.g. $greetings from $controlName is valid velocity template.
java.util.Map context
Context as Map to be provided to the velocity engine for variable, properties or method reference substitution.

Invoking the control

evaluate method of the VelocityTemplatingEngine is invoked as follows:
String template = $greetings from $controlName;
Map context = new HashMap();
context.put("greetings" , "Hello");
context.put("controlName" , "Velocity Templating Control");
String result = control.evaluate(template , context);

Using the result

Control returns a string which is evaluated velocity template.

The Java Page Flow sample that accompanies the VelocityTemplating Control demonstrates how to use the control.