码迷,mamicode.com
首页 > 其他好文 > 详细

HTTL版Hello World

时间:2018-03-09 15:06:48      阅读:151      评论:0      收藏:0      [点我收藏+]

标签: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

标签:httl

原文地址:http://blog.51cto.com/lavasoft/2084576

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!