0
春ブートアプリケーションでは、私はこのような配列内のインデックス変数を使用しようとすると、エラーを解析し、私を与える:春ブーツ+ Thymeleafループでエラーを解析Thymeleafの景色を望む
<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>
この<td th:text=${stat.index}>Index</td>
ラインはテスト目的のためであり、それができます正しいインデックス値ですが、次の行の<td> <input type="text" th:field=*{commonDataItems[__${stat.index}__].value>Value</td>
は解析エラーです。 エラーメッセージ:
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]
何か問題がありますか?
引用符が欠落しているかということは、単にタイプミスです: '番目:フィールド= " * {commonDataItemsは[__ $ {stat.index} __]値"' –
おかげで、それはそれだった。今でも自分自身を誇りに思っていない:)あなたは答えとしてそれを書くことができ、私はそれを受け入れるだろう。 – JohnP
Ta、ちょうど新しい目が必要でした:-) –