instagram

Apache Velocity Tutorial Part 1

Apache velocity is being used by developer to create dynamic string from predefine template.

Lets start with example directly.

Download below dependencies.

You can create Velocity object in two different ways.
1. Using Singleton class (More Preferable)
2. Create new instance of VelocityEngine using “new” keyword.

Template format :
Velocity template contains .vm as an extension. Please find below template example.vm

Lets consider above template and start with below example.

Singleton

Create multiple objects

Use Of Velocity Methods

Share