Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src Fixed typo (#73) Apr 26, 2018
pom.xml 2.7.1 release prep Nov 14, 2017


How to use the Apache Velocity template route for Spark example:

import static spark.Spark.get;

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

import spark.Request;
import spark.Response;
import spark.template.velocity.VelocityTemplateEngine;

 * VelocityTemplateRoute example.
public final class VelocityExample {
    public static void main(final String[] args) {

        get("/hello", (request, response) -> {
            Map<String, Object> model = new HashMap<>();
            model.put("hello", "Velocity World");
            model.put("person", new Person("Foobar"));

            // The vm files are located under the resources directory
            return new ModelAndView(model, "hello.vm");
        }, new VelocityTemplateEngine());


    public static class Person {
        private String name;

        public Person(String name) {
   = name;

        public String getName() {
            return name;
        public void setName(String name) {
   = name;