microsling FreeMarker templates

back to homepage

Scripts found by the SlingScriptResolver using the .ftl extension are executed by the FreemarkerScriptEngine.

This works exactly like the Velocity templates, except that templates use the FreeMarker syntax.

Here's an example HTML template. See the FreeMarker website more info about the syntax.

<html>
<body>
<h1>This is generated from a FreeMarker template</h1>
<p>
  The current resource URI is <b>${resource.URI}</b>
</p>

<h2>${resource.getItem().getProperty("title").getString()}</h2>
<p>
  ${resource.getItem().getProperty("text").getString()}
</p>

</body>