Header Ads

  • Breaking Now

    Velocity Framework

    What is Velocity Framework?
    Velocity is a Java based template engine.It permits anyone to use a simple yet powerful template language to reference objects defined in Java code.Velocity is inspired from 'WebMacro' , an alternative to JSP,PHP and ASP( www.webmacro.org).

    Where can Velocity be used?

    Velocity framework can be used in following areas:
    - Web apps, dynamic HTML pages are created and processed with VelocityViewServlet or number of frameworks that support Velocity
    - Source code generation
    - Automatic e-mails
    - XML transformation, provides an ant task called Anakia which reads an XML file and makes it available to a Velocity template.

    What are the features of Velocity?
    Velocity framework has following features:
    - Velocity is MVC based
    - It segregates HTML template code from Java code
    - It emphasizes on role based web app development
    - Velocity offers better maintainable web applications

    How Velocity works?
    When using Velocity in an application program or in a servlet (or anywhere, actually), you will generally do the following :
    - Initialize Velocity. This applies to both usage patterns for Velocity, the Singleton as well as the 'separate runtime instance', and you only do this once.
    - Create a Context object.
    - Add your data objects to the Context.
    - Choose a template.
    - 'Merge' the template and your data to produce the output.

    An Emailing template creation using Velocity framework
    Velocity With XML

    Post Top Ad

    Post Bottom Ad