【发布时间】:2018-09-17 04:49:33
【问题描述】:
我正在尝试访问在我的 ftl 文件中具有字符串、列表和地图类型字段的对象。
Configuration configuration = prepareConfiguration();
configuration.setClassForTemplateLoading(this.getClass(), "/");
Map<String, Object> mapVal = new HashMap<String, Object>();
mapVal.put("package", packageListing);
Template template = configuration.getTemplate("listing/listing.ftl");
StringWriter stringWriter = new StringWriter();
template.process(mapVal, stringWriter);
String string = stringWriter.toString();
这是我的代码的 sn-p。我有一个类型的字段
Map<String, ArrayList<ArrayList<Object>>>
在我的 packageListing 对象中。我正在尝试访问对象列表。类似于 Java 中的 Map.get(Key).get(index)。
【问题讨论】:
标签: java jsp freemarker