public abstract class

FreeMarkerTemplateUtils

extends Object
java.lang.Object
   ↳ org.springframework.ui.freemarker.FreeMarkerTemplateUtils

Class Overview

Utility class for working with FreeMarker. Provides convenience methods to process a FreeMarker template with a model.

Summary

Public Constructors
FreeMarkerTemplateUtils()
Public Methods
static String processTemplateIntoString(Template template, Object model)
Process the specified FreeMarker template with the given model and write the result to the given Writer.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public FreeMarkerTemplateUtils ()

Public Methods

public static String processTemplateIntoString (Template template, Object model)

Process the specified FreeMarker template with the given model and write the result to the given Writer.

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

Parameters
model the model object, typically a Map that contains model names as keys and model objects as values
Returns
  • the result as String
Throws
IOException if the template wasn't found or couldn't be read
if rendering failed
TemplateException