当前位置: 首页 > 工具软件 > HTTL > 使用案例 >

HTTL版Hello World

丌官绍元
2023-12-01
   <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);
}

转载于:https://blog.51cto.com/lavasoft/2084576

 类似资料: