public class FreeMarkerTemplateManager extends TemplateManager
Constructor and Description |
---|
FreeMarkerTemplateManager() |
Modifier and Type | Method and Description |
---|---|
FreeMarkerTag |
getTag(String tagName)
Returns an instance of
FreeMarkerTag . |
void |
merge(Map<String,Object> input,
String template,
String layout,
String format,
Writer writer)
Merges values with templates and writes a merged template to the writer.
|
void |
merge(Map<String,Object> values,
String template,
Writer writer)
Same as
TemplateManager.merge(java.util.Map, String, String, String, java.io.Writer) , but uses default layout and default format (html). |
void |
registerTag(String name,
FreeMarkerTag tag)
Registers an application-specific tag.
|
void |
setDefaultLayout(String layoutPath) |
void |
setServletContext(javax.servlet.ServletContext ctx)
A template manager might need a context to be able to load templates from it.
|
void |
setTemplateClassPath(String path)
This method exists for testing.
|
void |
setTemplateLocation(String templateLocation) |
sessionId
public void merge(Map<String,Object> values, String template, Writer writer)
TemplateManager
TemplateManager.merge(java.util.Map, String, String, String, java.io.Writer)
, but uses default layout and default format (html).merge
in class TemplateManager
public void merge(Map<String,Object> input, String template, String layout, String format, Writer writer)
TemplateManager
merge
in class TemplateManager
input
- values to be merged.template
- name of template in format: dir/template
without
file extension. This is to support multiple template technologies in the future.layout
- name of layout, null
if no layout is needed.writer
- Writer to write results to.public void setServletContext(javax.servlet.ServletContext ctx)
TemplateManager
setServletContext
in class TemplateManager
ctx
- servlet contextpublic void setTemplateClassPath(String path) throws IOException
path
- path to directory with test templates.IOException
- exception if directory not present.public void setDefaultLayout(String layoutPath)
public void setTemplateLocation(String templateLocation)
setTemplateLocation
in class TemplateManager
templateLocation
- this can be absolute or relative.public void registerTag(String name, FreeMarkerTag tag)
name
- name of tag.tag
- tag instance.public FreeMarkerTag getTag(String tagName)
FreeMarkerTag
. Use this method
to further configure specific tags.tagName
- name of tag as used in a templateCopyright © 2020 JavaLite. All rights reserved.