org.springframework.ui.freemarker
Class FreeMarkerTemplateUtils

java.lang.Object
  extended by org.springframework.ui.freemarker.FreeMarkerTemplateUtils

public abstract class FreeMarkerTemplateUtils
extends Object

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

Since:
14.03.2004
Author:
Juergen Hoeller

Constructor Summary
FreeMarkerTemplateUtils()
           
 
Method Summary
static String processTemplateIntoString(Template template, Object model)
          Process the specified FreeMarker template with the given model and write the result to the given Writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreeMarkerTemplateUtils

public FreeMarkerTemplateUtils()
Method Detail

processTemplateIntoString

public static String processTemplateIntoString(Template template,
                                               Object model)
                                        throws IOException,
                                               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 - 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
TemplateException - if rendering failed
See Also:
MailPreparationException


Copyright (c) 2002-2007 The Spring Framework Project.