1. 程式人生 > >HTTL版Hello World

HTTL版Hello World

httl

<dependency> <groupId>com.github.httl</groupId> <artifactId>httl</artifactId> <version>1.0.11</version> </dependency>

import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;
import httl.Engine;
import httl.Template;

public static void main(String[] args) throws ParseException {
    String str = "hello,${name}";
    Map<String, Object> params = new HashMap<>(); 
    params.put("name", "httl");
    Engine engine = Engine.getEngine();
    Template template = engine.parseTemplate(str);
    String result = (String) template.evaluate(params);
    System.out.printf(result);
}

HTTL版Hello World