dromara / hutool

🍬A set of tools that keep Java sweet.
https://hutool.cn
Other
29.17k stars 7.52k forks source link

路大,我又来了 #159

Closed c472672231 closed 6 years ago

c472672231 commented 6 years ago

把enjoy模板的使用案例添加一下啊,我看api文档,实在搞不明白怎么用。QAQ

looly commented 6 years ago

1、引入依赖

<dependency>
    <groupId>com.jfinal</groupId>
    <artifactId>enjoy</artifactId>
    <version>3.4</version>
</dependency>
//自动根据你引入的模板引擎jar判断使用的模板引擎
Engine engine = TemplateUtil.createEngine(new TemplateConfig());
Template template = engine.getTemplate("#(x + 123)");
String result = template.render(Dict.create().set("x", 1));
//结果为:124
looly commented 6 years ago

文档也做了补充,见:《模板引擎封装-TemplateUtil》

文档地址:http://hutool.mydoc.io/