Find file History
Latest commit 96d7a25 Nov 5, 2016 @tipsy tipsy Update jinjava engine
Permalink
..
Failed to load latest commit information.
src Update jinjava engine Nov 5, 2016
README.md moved freemarker to new repository May 13, 2014
pom.xml Update jetbrick engine Nov 5, 2016

README.md

spark-template-freemarker

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());

    }

}