Skip to content
This repository has been archived by the owner on Dec 4, 2019. It is now read-only.
/ spark-template-httl Public archive

Httl Template engine implementation for Spark web framework

Notifications You must be signed in to change notification settings

azazar/spark-template-httl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

spark-template-httl

Maven dependency:

<dependency>
    <groupId>com.github.azazar</groupId>
    <artifactId>spark-template-httl</artifactId>
    <version>2.8.0</version>
</dependency>

How to use the Httl 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.httl.HttlTemplateEngine;

/**
 * HttlTemplateRoute example.
 */
public final class HttlExample {
    
    public static void main(final String[] args) {

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

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

    }

    public static class Person {
        private String name;

        public Person(String name) {
            this.name = name;
        }

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

About

Httl Template engine implementation for Spark web framework

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages