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


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