【发布时间】:2017-04-20 15:29:58
【问题描述】:
我正在使用#strings.substr() 函数,它给出了以下错误:
出现意外错误
(type=Internal Server Error, status=500)。 评估 SpringEL 表达式的异常:"#strings.substr(status,iter.index,iter.index+1)"(init:37)
这是代码:
<tbody>
<tr th:each="task,iter : ${taskList}">
<td th:text="${task.id}"></td>
<td th:text="${task.task}"></td>
<td th:switch="${#strings.substr(status,iter.index,iter.index+1)}">
<div th:case="'0'"><input type="checkbox"/></div>
<div th:case="'1'"><input type="checkbox" checked="checked"/></div>
<div th:case="*"><input type="checkbox" id="checkbtn" checked="checked"/></div>
</td>
</tr>
</tbody>
这是错误日志:
Exception evaluating SpringEL expression: "#strings.substr(status,iter.index,iter.index+1)" (init:37)] with root cause
org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 9): Method call: Method substr(netgloo.models.Exit,java.lang.Integer,java.lang.Integer) cannot be found on org.thymeleaf.expression.Strings type
我猜这个错误是由于 iter.index 的类型是 Integer 并且该函数需要一个 int。那么我该如何解决这个问题呢?谢谢
【问题讨论】:
标签: java spring-boot thymeleaf