【发布时间】:2015-12-30 02:44:49
【问题描述】:
我有一个创建 hashmap 的 springboot 应用程序。我想创建一个具有一个标题和多行的表(地图中的每个值一个)。以下代码返回一个 ISE:
出现意外错误(类型=内部服务器错误, 状态=500)。无法解析 URL 的 FreeMarker 模板 [toDoListView.ftl];嵌套异常是 freemarker.core.ParseException:模板中的语法错误 第 47 行第 37 列中的“toDoListView.ftl”:遇到“>”,但 期待以下之一:“..”“..”“作为”“。” "[" "(" "?" "!" “??” "+" "-" "" "/" "%" "!=" "=" "==" ">=" ">"
第 47 行是:
<#if itemMap??>
<table class="table table-bordered">
<#list itemMap>
<thead>
<tr>
<th></th>
<th>Item1</th>
<th>Item2</th>
<th>Item3</th>
</tr>
</thead>
<#item?keys as key>
<#if !itemMap?values[key_index].done>
<tbody>
<tr>
<td id="checkbox_column" width="40">
<input type="checkbox" name="im" value="${key}">
</td>
<#if itemMap?values[key_index].color == "BLUE">
<td>${itemMap?values[key_index].blue}</td>
<#elseif itemMap?values[key_index].color == "RED">
<td>${itemMap?values[key_index].red}</td>
</#if>
</tr>
</tbody>
</#if>
</#item?keys>
</table>
<#else>
No Items!
</#list>
我不确定是什么导致了这个错误。我试图按照表格 2 下列出的示例进行操作:http://freemarker.org/docs/ref_directive_list.html
【问题讨论】:
-
而
line 47, column 37是...? -
第 47 行是:
-
由于此信息与问题相当相关,因此我建议您将其编辑到答案中 - 也许注释特定的代码。
-
它在问题中,可能不是很明显,但它在代码块上方:/
-
如我的问题所述,我遵循表格 2: 如果我们有超过 0 个项目,则执行一次 为每个项目重复的部分#items>如果我们有超过 0 个项目,则部分执行一次 当有 0 个项目时执行部分 #list>
标签: java spring freemarker