Spring boot 弹簧靴&x2B;循环中的Thymeleaf分析错误
当我尝试在数组中使用索引变量时,带Thymeleaf视图的Spring Boot应用程序会出现解析错误,如下所示:Spring boot 弹簧靴&x2B;循环中的Thymeleaf分析错误,spring-boot,thymeleaf,Spring Boot,Thymeleaf,当我尝试在数组中使用索引变量时,带Thymeleaf视图的Spring Boot应用程序会出现解析错误,如下所示: <tr th:each="cdItem, stat : *{commonDataItems}"> <td th:text=${stat.index}>Index</td> <td> <input type="text" th:field=*{commonDataItems[__${
<tr th:each="cdItem, stat : *{commonDataItems}">
<td th:text=${stat.index}>Index</td>
<td> <input type="text" th:field=*{commonDataItems[__${stat.index}__].value>Value</td>
</tr>
有什么问题吗?缺少引号
th:field=“*{commonDataItems[\uuuu${stat.index}}\uuuuz].value”
因此:
指数
价值
缺少引号!th:field=“*{commonDataItems[\uuuu${stat.index}}.\uuu].value”
因此:
指数
价值
你是缺少引号还是仅仅是输入错误:th:field=“*{commonDataItems[\uuu${stat.index}}].value“
谢谢,就是这样。不过现在我并不太骄傲:)你可以把它作为答案写下来,我会接受的。Ta,你只是需要一些新的眼睛:-)你缺少引号还是仅仅是输入错误:th:field=“*{commonDataItems[\uuu${stat.index}\uuuvalue“
谢谢,就这样。不过现在我不太为自己感到骄傲:)你可以把它写下来作为答案,我会接受的。Ta,你只需要一些新鲜的眼睛:-)
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "*{commonDataItems[__${stat.index}__].value" (common)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:238) ~[thymeleaf-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:79) ~[thymeleaf-2.1.4.RELEASE.jar:2.1.4.RELEASE]
<tr th:each="cdItem, stat : *{commonDataItems}">
<td th:text=${stat.index}>Index</td>
<td> <input type="text" th:field="*{commonDataItems[__${stat.index}__].value">Value</td>
</tr>