<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