Joined: 16/02/2012 12:59:39
Velocity is a Java-based template engine that provides a simple yet powerful template language to reference objects defined in Java code. Its aim is to ensure clean separation between the presentation tier and business tiers in a Web application (the model–view–controller design pattern).
A common implementation of the velocity engine is sending template based emails by passing certain values into it. The following example makes use of the apache velocity to pass values from a java class into the email template called"email_html.vm". This program requires the following .jar files to be included in your class path:
The java class is called the"EmailDemo.java" is placed inside the src folder and looks like as follows:
create another file "email_html.vm" and place it inside the same src folder and it looks like as follows: