Liqp(java液体模板引擎)访问对象字段
我试图使用解析字符串模板,但无法访问我放入上下文中的对象的字段Liqp(java液体模板引擎)访问对象字段,java,liquid,Java,Liquid,我试图使用解析字符串模板,但无法访问我放入上下文中的对象的字段 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); Map model
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);
Map model=newhashmap();
模型放置(“测试”,新测试(“字段值”);
Template=Template.parse(“Something{{test.field}”);
字符串输出=template.render(model);
该字段是公共的,具有getter和所有可能的访问方式
上面代码的输出是:“Something”您应该将
测试实例转换为JSON或映射。但由于0.7.3-SNAPSHOT
,因此不再需要: