Find file History
Latest commit fd1c27b Nov 14, 2017
Permalink
..
Failed to load latest commit information.
src Update pebble engine Nov 5, 2016
README.md Redo pebble templating, correctly this time. Apr 14, 2015
pom.xml 2.7.1 release prep Nov 14, 2017

README.md

spark-template-pebble

How to use the Pebble template route for Spark example:

import spark.ModelAndView;
import spark.template.pebble.PebbleTemplateEngine;

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

import static spark.Spark.get;

/**
 * @author Nikki
 */
public class PebbleExample {

	public static void main(String[] args) {
		get("/hello", (request, response) -> {
			Map<String, Object> attributes = new HashMap<>();
			attributes.put("message", "Hello World!");

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