public interface TemplateScript
Modifier and Type | Method and Description |
---|---|
TemplateModel |
getModel()
The backing model for this template.
|
String |
html(Object value)
Escapes the toString() value of the given object, by way of
HtmlEscapers . |
String |
render(Map<String,?> model,
String templateName)
Renders a nested template inline, with the given model merged with the current template model.
|
String |
render(String templateName)
Renders a nested template inline, using the same model as this template.
|
String |
urlParam(Object value)
Escapes the toString() value of the given object, by way of
UrlEscapers.urlFormParameterEscaper() . |
String |
urlPathSegment(Object value)
Escapes the toString() value of the given object, by way of
UrlEscapers.urlPathSegmentEscaper() . |
TemplateModel getModel()
String render(String templateName) throws Exception
templateName
- The name of the template to renderException
- if an error occurs compiling/executing the templaterender(java.util.Map, String)
String render(Map<String,?> model, String templateName) throws Exception
The nested template will be rendered directly to the underlying buffer; it is not returned from this method.
This method returns an empty string so that it can be used in situations where the return value would have been
included in the output (e.g. a <?= ?>
block).
The template name is resolved into a template using the same renderer that initiated rendering of this template.
model
- The model to merge with the current template modeltemplateName
- The name of the template to renderException
- if an error occurs compiling/executing the templateString html(Object value)
HtmlEscapers
.value
- the value to escapeString urlParam(Object value)
UrlEscapers.urlFormParameterEscaper()
.value
- the value to escapeString urlPathSegment(Object value)
UrlEscapers.urlPathSegmentEscaper()
.value
- the value to escape