2017-05-26 195 views
2

我試圖用Liqp來解析字符串模板,但我無法訪問我放在上下文中的對象的字段....Liqp(用於java的液體模板引擎)訪問對象字段

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); 

該字段是公開的,具有獲取者和所有可能的訪問方式。

上述代碼的ouptut是:你預計到Test實例轉換成JSON或Map「東西」

回答