{{parent.child.0.field}} 它没有解决,如果 child 是 java.util.Set。如果它是 java.util.List 则有效
{{parent.child.0.field}} it not resolved, if child is java.util.Set. Works if it was a java.util.List
模板:
{{parent.child.0.field}}
上下文:
Mustache.Compiler c = Mustache.compiler();
Parent parentObj = new Parent();
Map<String, Object> ctx = Maps.newHashMap();
ctx.put("parent", parentObj);
c.compile(templateHtml).execute(ctx);
异常:
"exception" : "com.samskivert.mustache.MustacheException$Context",
"message" : "Missing context for compound variable 'parent.child.0.field' on line 1. '0' was not found."
有没有将 Child 的模板或数据类型从“设置”更改为“列表”的解决方法?
因为Set dosn't have get(int index)方法像List
模板:
{{parent.child.0.field}}
上下文:
Mustache.Compiler c = Mustache.compiler();
Parent parentObj = new Parent();
Map<String, Object> ctx = Maps.newHashMap();
ctx.put("parent", parentObj);
c.compile(templateHtml).execute(ctx);
异常:
"exception" : "com.samskivert.mustache.MustacheException$Context",
"message" : "Missing context for compound variable 'parent.child.0.field' on line 1. '0' was not found."
有没有将 Child 的模板或数据类型从“设置”更改为“列表”的解决方法?
因为Set dosn't have get(int index)方法像List