Skip to content

FreeMarker

//templates_freemarker

templates_freemarker

[jvm]

This module provides an adapter for the templates Port supporting the Apache FreeMarker template engine.

Install the Dependency

1
2
3
4
5
repositories {
    mavenCentral()
}

implementation("com.hexagonkt:templates_freemarker:$hexagonVersion")
1
2
3
4
5
<dependency>
  <groupId>com.hexagonkt</groupId>
  <artifactId>templates_freemarker</artifactId>
  <version>$hexagonVersion</version>
</dependency>

How to Use

val contextVariables = hashMapOf(
"contextVariableKey" to contextVariableValue
)
val renderedPage = FreeMarkerAdapter.render(
"templates/page.html",
Locale.getDefault(),
contextVariables
)

If you have no context variables, you can simply pass an empty map:

val renderedPage = FreeMarkerAdapter.render(
"templates/page.html",
Locale.getDefault(),
hashMapOf()
)

Packages

Name
com.hexagonkt.templates.freemarker

Comments