我尝试使用Liqp来解析字符串模板,但我无法访问我在上下文中放置的对象的字段....
Map<String, Object> model = new HashMap<>();
model.put("test", new Test("Value of field"));
Template template = Template.parse("Something {{test.field}}");
String output = template.render(model);
该领域是公开的,有吸气剂和各种可能的访问方式。
上述代码的输出是:&#34; Something&#34;
答案 0 :(得分:1)
您需要将Test
实例转换为JSON或Map
。但自0.7.3-SNAPSHOT
以来,不再需要https://github.com/bkiers/Liqp/pull/67