Interface TextTemplateScript


  • public interface TextTemplateScript
    The API available in template files.
    • Method Detail

      • getModel

        TextTemplateModel getModel()
        The backing model for this template.
        Returns:
        The backing model for this template
      • render

        String render​(String templateName)
               throws Exception
        Renders a nested template inline, using the same model as this template.
        Parameters:
        templateName - The name of the template to render
        Returns:
        An empty string
        Throws:
        Exception - if an error occurs compiling/executing the template
        See Also:
        render(java.util.Map, String)
      • render

        String render​(Map<String,​?> model,
                      String templateName)
               throws Exception
        Renders a nested template inline, with the given model merged with the current template model.

        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.

        Parameters:
        model - The model to merge with the current template model
        templateName - The name of the template to render
        Returns:
        The rendered template content
        Throws:
        Exception - if an error occurs compiling/executing the template
      • html

        String html​(Object value)
        Escapes the toString() value of the given object, by way of HtmlEscapers.
        Parameters:
        value - the value to escape
        Returns:
        a minimally escaped version of the given value
      • urlParam

        String urlParam​(Object value)
        Escapes the toString() value of the given object, by way of UrlEscapers.urlFormParameterEscaper().
        Parameters:
        value - the value to escape
        Returns:
        an escaped version of the given value
      • urlPathSegment

        String urlPathSegment​(Object value)
        Escapes the toString() value of the given object, by way of UrlEscapers.urlPathSegmentEscaper().
        Parameters:
        value - the value to escape
        Returns:
        an escaped version of the given value