<dependency>
<groupId>org.chunkframework</groupId>
<artifactId>chunk-templates</artifactId>
<version>1.0.0</version>
</dependency>
html
<html>
<head>
<title>Chunk Templates Example</title>
</head>
<body>
<h1>Hello {{name}}!</h1>
</body>
</html>
public class Person {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Person person = new Person();
person.setName("World");
Chunk chunk = new Chunk();
chunk.setTemplate("path/to/template.html");
chunk.put("name", person.getName());
String output = chunk.render();
try (PrintWriter writer = new PrintWriter("path/to/output.html")) {
writer.print(output);
}