Top Description Constructors Methods
org.springframework.ui.freemarker

public abstract Class FreeMarkerTemplateUtils

extends Object
Class Inheritance
Imports
java.io.IOException, .StringWriter, freemarker.template.Template, freemarker.template.TemplateException

Utility class for working with FreeMarker. Provides convenience methods to process a FreeMarker template with a model.
Author
Juergen Hoeller
Since
14.03.2004

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

the result as String
processTemplateIntoString
(freemarker.template.Template template, Object
the model object, typically a Map that contains model names as keys and model objects as values
model
)

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

FreeMarkerTemplateUtilsback to summary
public FreeMarkerTemplateUtils()

Method Detail

processTemplateIntoStringback to summary
public static String processTemplateIntoString(freemarker.template.Template template, Object model) throws IOException, freemarker.template.TemplateException

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:Object

the model object, typically a Map that contains model names as keys and model objects as values

Returns:String

the result as String

Exceptions
IOException:
if the template wasn't found or couldn't be read
TemplateException:
if rendering failed
See Also
org.springframework.mail.MailPreparationException