我正在尝试使用Thymeleaf从模板内的语言文件迭代一个拆分的字符串。但这不起作用。

范本范例:

                <div class="row"  th:with="SPlatform=#{platforms}">
                    <div class="input-field col s4" th:each="platform : ${#strings.arraySplit(SPlatform, ',')}">
                        <input type="checkbox" class="filled-in" th:id="platforms"> <label
                            th:for="platforms" th:text=""></label>
                    </div>
                </div>


语言文件#{platforms}中的messages_en.properties的值为

platforms=Platform1,Platform2,Platform3


但最后我得到了这个错误:

This application has no explicit mapping for /error, so you are seeing this as a fallback.

    Mon Aug 31 16:44:33 GST 2015
    There was an unexpected error (type=Internal Server Error, status=500).
    Could not parse as expression: "" (platform-add)

最佳答案

问题可能是

th:text=""

在您的标签内。

Thymeleaf期望表达式显示一些文本。

08-25 16:19