FreeMarker template error (HTML_DEBUG mode; use RETHROW in production!) The following has evaluated to null or missing: ==> gc.id [in template "goods/category/goodsAdd.ftlh" at line 136, column 66]
前端代码:
<select name="parent_id_1" id="parent_id_1"
onchange="get_category(this.value,'parent_id_2','0');"
class="small form-control">
<option value="0">顶级分类</option>
<#list gcList as gc>
<option value="${gc.id}">${gc.name}</option>
</#list>
</select>
这是由于gc.id出现空值的原因
只需要在配置文件中加上,就好了
freemarker:
settings:
classic_compatible: true
文章讨论了一个在FreeMarker模板引擎中遇到的问题,具体是HTML_DEBUG模式下,由于变量gc.id在goodsAdd.ftlh模板的第136行第66列被评估为null或缺失导致的错误。前端代码显示为一个选择列表,其中gc.id用于选项值。解决方案是在Freemarker配置文件中启用classic_compatible选项来处理空值情况。
3520

被折叠的 条评论
为什么被折叠?



