Map<String, String> model = new HashMap<String, String>();
model.put("A", "1");
model.put("b", "2");
model.put("c", "3");
try{
content.append(FreeMarkerTemplateUtils.processTemplateIntoString(configuration.getTemplate(ftlName), model));
...
Ftl 文件如下所示:
<html><head></head><body>
${model["A"]}
<#list model?keys as prop>
${model[prop]}
</#list>
</body>
</html>
无论我收到错误消息:
Expression model is undefined on line 6, column 3 in vslEmail.ftl.
The problematic instruction:
----------
==> ${model["A"]} [on line 6, column 1 in vslEmail.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression model is undefined on line 6, column 3 in vslEmail.ftl.
如果我删除尝试model
仅使用列表指令访问,我会得到同样的错误......任何帮助表示赞赏