I have the following method that renders a list of users on the template, but I got a 500 Internal Error when firing up Spark in IntelliJ.
private void renderTemplate() throws IOException, TemplateException {
List<String> users = new ArrayList<>();
users.add("John Doe");
users.add("Tony Doe");
get("/admin", (request, response) -> {
return new ModelAndView(users, "spark/template/freemarker/admin_template.ftl");
}, new FreeMarkerEngine());
}
The content of my admin_template.ftl is:
<html>
<head>
<title>Administration</title>
</head>
<body>
<h1>My Admin</h1>
<#list users as user>
<h2>$user</h2>
</#list>
</body>
</html>
Does anyone know how to render the list on freemarker template? thanks for replies!