Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src Update jinjava engine Nov 5, 2016 moved freemarker to new repository May 13, 2014
pom.xml 2.7.1 release prep Nov 14, 2017


How to use the FreeMarker template route for Spark example:

import java.util.HashMap;
import java.util.Map;

import org.junit.Test;

import junit.framework.Assert;
import spark.ModelAndView;
import spark.template.freemarker.FreeMarkerEngine;

import static spark.Spark.get;

public class FreeMarkerExample {

    public static void main(String args[]) {

        get("/hello", (request, response) -> {
            Map<String, Object> attributes = new HashMap<>();
            attributes.put("message", "Hello World!");

            // The hello.ftl file is located in directory:
            // src/test/resources/spark/template/freemarker
            return new ModelAndView(attributes, "hello.ftl");
        }, new FreeMarkerEngine());