Velocity is used as joist.web’s rendering engine. It allows a nice balance of control-driven and template-driven rendering.
Velocity 1.6 introduced a Renderable interface that allows variables in the Velocity model to override how they are included in the template.
joist.web’s AbstractControl implements this interface, wraps the Velocity’s internals in a joist.web HtmlWriter and then delegates to the normal joist.web Control.render method.
This means that in the template:
<some html>
$control
</some html>
Velocity will call control.render(InternalContextAdapter,Writer), which will call control.render(HtmlWriter), achieving streaming output of the control’s content to Velocity’s writer.