VelocityEngineUtils (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.ui.velocity

## Class VelocityEngineUtils

- java.lang.Object
- - org.springframework.ui.velocity.VelocityEngineUtils

-     public abstract class VelocityEngineUtils
      extends Object

  Utility class for working with a VelocityEngine. Provides convenience methods to merge a Velocity template with a model.
  Since:
    22.01.2004
  Author:
    Juergen Hoeller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `VelocityEngineUtils()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `mergeTemplate(org.apache.velocity.app.VelocityEngine velocityEngine, String templateLocation, Map<String,Object> model, Writer writer)` Deprecated. Use `mergeTemplate(VelocityEngine, String, String, Map, Writer)` instead, following Velocity 1.6's corresponding deprecation in its own API.
    `static void` | `mergeTemplate(org.apache.velocity.app.VelocityEngine velocityEngine, String templateLocation, String encoding, Map<String,Object> model, Writer writer)` Merge the specified Velocity template with the given model and write the result to the given Writer.
    `static String` | `mergeTemplateIntoString(org.apache.velocity.app.VelocityEngine velocityEngine, String templateLocation, Map<String,Object> model)` Deprecated. Use `mergeTemplateIntoString(VelocityEngine, String, String, Map)` instead, following Velocity 1.6's corresponding deprecation in its own API.
    `static String` | `mergeTemplateIntoString(org.apache.velocity.app.VelocityEngine velocityEngine, String templateLocation, String encoding, Map<String,Object> model)` Merge the specified Velocity template with the given model into a String.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VelocityEngineUtils

          public VelocityEngineUtils()

  - ### Method Detail

    - #### mergeTemplate

          @Deprecated
          public static void mergeTemplate(org.apache.velocity.app.VelocityEngine velocityEngine,
                                      String templateLocation,
                                      Map<String,Object> model,
                                      Writer writer)
                                    throws org.apache.velocity.exception.VelocityException

      Deprecated. Use `mergeTemplate(VelocityEngine, String, String, Map, Writer)` instead, following Velocity 1.6's corresponding deprecation in its own API.
      Merge the specified Velocity template with the given model and write the result to the given Writer.
      Parameters:
        `velocityEngine` - VelocityEngine to work with
        `templateLocation` - the location of template, relative to Velocity's resource loader path
        `model` - the Map that contains model names as keys and model objects as values
        `writer` - the Writer to write the result to
      Throws:
        `org.apache.velocity.exception.VelocityException` - if the template wasn't found or rendering failed

    - #### mergeTemplate

          public static void mergeTemplate(org.apache.velocity.app.VelocityEngine velocityEngine,
                           String templateLocation,
                           String encoding,
                           Map<String,Object> model,
                           Writer writer)
                                    throws org.apache.velocity.exception.VelocityException

      Merge the specified Velocity template with the given model and write the result to the given Writer.
      Parameters:
        `velocityEngine` - VelocityEngine to work with
        `templateLocation` - the location of template, relative to Velocity's resource loader path
        `encoding` - the encoding of the template file
        `model` - the Map that contains model names as keys and model objects as values
        `writer` - the Writer to write the result to
      Throws:
        `org.apache.velocity.exception.VelocityException` - if the template wasn't found or rendering failed

    - #### mergeTemplateIntoString

          @Deprecated
          public static String mergeTemplateIntoString(org.apache.velocity.app.VelocityEngine velocityEngine,
                                                  String templateLocation,
                                                  Map<String,Object> model)
                                                throws org.apache.velocity.exception.VelocityException

      Deprecated. Use `mergeTemplateIntoString(VelocityEngine, String, String, Map)` instead, following Velocity 1.6's corresponding deprecation in its own API.
      Merge the specified Velocity template with the given model into a String.

      When using this method to prepare a text for a mail to be sent with Spring's mail support, consider wrapping VelocityException in MailPreparationException.

      Parameters:
        `velocityEngine` - VelocityEngine to work with
        `templateLocation` - the location of template, relative to Velocity's resource loader path
        `model` - the Map that contains model names as keys and model objects as values
      Returns:
        the result as String
      Throws:
        `org.apache.velocity.exception.VelocityException` - if the template wasn't found or rendering failed
      See Also:
        `MailPreparationException`

    - #### mergeTemplateIntoString

          public static String mergeTemplateIntoString(org.apache.velocity.app.VelocityEngine velocityEngine,
                                       String templateLocation,
                                       String encoding,
                                       Map<String,Object> model)
                                                throws org.apache.velocity.exception.VelocityException

      Merge the specified Velocity template with the given model into a String.

      When using this method to prepare a text for a mail to be sent with Spring's mail support, consider wrapping VelocityException in MailPreparationException.

      Parameters:
        `velocityEngine` - VelocityEngine to work with
        `templateLocation` - the location of template, relative to Velocity's resource loader path
        `encoding` - the encoding of the template file
        `model` - the Map that contains model names as keys and model objects as values
      Returns:
        the result as String
      Throws:
        `org.apache.velocity.exception.VelocityException` - if the template wasn't found or rendering failed
      See Also:
        `MailPreparationException`