Uses of Class
freemarker.template.Template
Packages that use Template
Package
Description
Template loading and caching.
The seldom used or advanced parts of the fundamental FreeMarker API, compared to
freemarker.template
.Servlet for legacy "Model 2" frameworks that allows using FreeMarker
templates instead of JSP as the MVC View
(see in the Manual).
The fundamental, most commonly used API-s of FreeMarker;
start with
Configuration
(see also the
Getting Started in the Manual.)-
Uses of Template in freemarker.cache
Methods in freemarker.cache that return TemplateModifier and TypeMethodDescriptionTemplateCache.getTemplate
(String name, Locale locale, String encoding, boolean parseAsFTL) Deprecated.TemplateCache.MaybeMissingTemplate.getTemplate()
TheTemplate
if it wasn't missing, otherwisenull
. -
Uses of Template in freemarker.core
Methods in freemarker.core that return TemplateModifier and TypeMethodDescriptionEnvironment.getCurrentTemplate()
Returns theTemplate
that we are "lexically" inside at the moment.Environment.getMainTemplate()
Returns the topmostTemplate
, with other words, the one for which thisEnvironment
was created.DirectiveCallPlace.getTemplate()
The template that contains this call;null
if the call is not from a template (but directly from user Java code, for example).Environment.getTemplate()
Deprecated.UseEnvironment.getMainTemplate()
instead (orEnvironment.getCurrentNamespace()
and thenEnvironment.Namespace.getTemplate()
); the value returned by this method is often not what you expect when it comes to macro/function invocations.Environment.Namespace.getTemplate()
Environment.getTemplateForImporting
(String name) Gets a template for importing; used withEnvironment.importLib(Template importedTemplate, String namespace)
.Environment.getTemplateForInclusion
(String name, String encoding, boolean parse) Same asEnvironment.getTemplateForInclusion(String, String, boolean, boolean)
withfalse
ignoreMissing
argument.Environment.getTemplateForInclusion
(String name, String encoding, boolean parseAsFTL, boolean ignoreMissing) Gets a template for inclusion; used for implementingEnvironment.include(Template includedTemplate)
.Methods in freemarker.core with parameters of type TemplateModifier and TypeMethodDescriptionvoid
Sets those settings of theTemplate
which aren't yet set in theTemplate
and are set in thisTemplateConfiguration
, leaves the other settings as is.final Object
Does what the#import
directive does, but with an already loaded template.void
Processes a Template in the context of thisEnvironment
, including its output in theEnvironment
's Writer.OptInTemplateClassResolver.resolve
(String className, Environment env, Template template) TemplateClassResolver.resolve
(String className, Environment env, Template template) Gets aClass
based on the class name.protected String
OptInTemplateClassResolver.safeGetTemplateName
(Template template) Extract the template name from the template object which will be matched against the trusted template names and pattern.final void
void
FreeMarkerTree.setTemplate
(Template template) Deprecated.Constructors in freemarker.core with parameters of type TemplateModifierConstructorDescriptionEnvironment
(Template template, TemplateHashModel rootDataModel, Writer out) FreeMarkerTree
(Template template) Deprecated.ParseException
(String description, Template template, int lineNumber, int columnNumber) Deprecated.UseParseException(String, Template, int, int, int, int)
instead, as IDE-s need the end position of the error too.ParseException
(String description, Template template, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber) ParseException
(String description, Template template, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, Throwable cause) ParseException
(String description, Template template, int lineNumber, int columnNumber, Throwable cause) Deprecated.UseParseException(String, Template, int, int, int, int, Throwable)
instead, as IDE-s need the end position of the error too.ParseException
(String description, Template template, freemarker.core.Token tk) ParseException
(String description, Template template, freemarker.core.Token tk, Throwable cause) -
Uses of Template in freemarker.ext.servlet
Methods in freemarker.ext.servlet with parameters of type TemplateModifier and TypeMethodDescriptionprotected void
FreemarkerServlet.postTemplateProcess
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Template template, TemplateModel data) Called after the execution returns fromprocess(Object, java.io.Writer)
.protected boolean
FreemarkerServlet.preTemplateProcess
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Template template, TemplateModel model) Called before the execution is passed toprocess(Object, java.io.Writer)
. -
Uses of Template in freemarker.template
Methods in freemarker.template that return TemplateModifier and TypeMethodDescriptionstatic Template
Template.getPlainTextTemplate
(String name, String content, Configuration config) static Template
Template.getPlainTextTemplate
(String name, String sourceName, String content, Configuration config) Creates (not "get"-s) aTemplate
that only contains a single block of static text, no dynamic content.Configuration.getTemplate
(String name) Retrieves the template with the given name from the template cache, loading it into the cache first if it's missing/staled.Configuration.getTemplate
(String name, String encoding) Shorthand forgetTemplate(name, null, null, encoding, true, false)
.Configuration.getTemplate
(String name, Locale locale) Shorthand forgetTemplate(name, locale, null, null, true, false)
.Configuration.getTemplate
(String name, Locale locale, Object customLookupCondition, String encoding, boolean parseAsFTL, boolean ignoreMissing) Retrieves the template with the given name (and according the specified further parameters) from the template cache, loading it into the cache first if it's missing/staled.Configuration.getTemplate
(String name, Locale locale, String encoding) Shorthand forgetTemplate(name, locale, null, encoding, true, false)
.Configuration.getTemplate
(String name, Locale locale, String encoding, boolean parseAsFTL) Shorthand forgetTemplate(name, locale, null, encoding, parseAsFTL, false)
.Configuration.getTemplate
(String name, Locale locale, String encoding, boolean parseAsFTL, boolean ignoreMissing)
TemplateCache.getTemplate(String, Locale, Object, String, boolean)
, which can return more detailed result when the template is missing.