【发布时间】:2018-03-04 16:59:58
【问题描述】:
在 FreeMarker 模板中,我将一个变量传递给 <#list>:
<#list sectorTags as sector>
<td colspan="${sector.designatedTags!?size}">${sector.name}</td>
<#else>
<td>No technology sectors defined.</td>
</#list>
但是失败了:
06:25:03,733 SEVERE freemarker.core.NonSequenceOrCollectionException: Expected a sequence or collection, but this has evaluated to an extended_hash+string (com.tinkerpop.frames.structures.FramedVertexIterable wrapped into f.e.b.StringModel):
==> sectorTags [in template "reports/templates/techReport-punchCard.ftl" at line 105, column 32]
----
FTL stack trace ("~" means nesting-related):
- Failed at: #list-#else-container [in template "reports/templates/techReport-punchCard.ftl" at line 105, column 25]
----
at freemarker.core.IteratorBlock$IterationContext.executeNestedBlockInner(IteratorBlock.java:295)
...
发生了什么事?
(如果其他人遇到这个问题,我会通过问答来解决这个问题 - 我在这里没有找到)
【问题讨论】:
标签: freemarker