Home » freemarker-2.3.13 » freemarker.template.utility » [javadoc | source]
freemarker.template.utility
public class: CaptureOutput [javadoc | source]
java.lang.Object
   freemarker.template.utility.CaptureOutput

All Implemented Interfaces:
    TemplateTransformModel

Deprecated! Use - block-assignments instead, as <assign x>...</assign>.

A transform that captures the output of a block of FTL code and stores that in a variable.

As this transform is initially present in the shared variable set, you can always access it from the templates:

<@capture_output var="captured">
...
</@capture_output>

And later in the template you can use the captured output:

${captured}

This transform requires one of three parameters: var, local, or global. Each of them specifies the name of the variable that stores the captured output, but the first creates a variable in a name-space (as <#assign>), the second creates a macro-local variable (as <#local>), and the last creates a global variable (as <#global>).

In the case of an assignment within a namespace, there is an optional parameter namespace that indicates in which namespace to do the assignment. if this is omitted, the current namespace is used, and this will be, by far, the most common usage pattern.

Method from freemarker.template.utility.CaptureOutput Summary:
getWriter
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from freemarker.template.utility.CaptureOutput Detail:
 public Writer getWriter(Writer out,
    Map args) throws TemplateModelException 
      Deprecated!