首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >迭代的胸腺迭代

迭代的胸腺迭代
EN

Stack Overflow用户
提问于 2018-06-18 10:05:31
回答 1查看 171关注 0票数 0

在我的域中,我有一个Commessa,它包含一个包含varieTransient列表的programmazioneTransient列表。

我创建了一个视图,显示第二个列表中的每个元素,并且运行得非常完美。现在,我添加了用于显示varieTransient列表的循环,但我有以下错误:

由: org.attoparser.ParseException:异常计算SpringEL表达式:SpringEL(模板:“视图/programmazione/show”)引起-第92行,在org.attoparser.MarkupParser.parseDocument(MarkupParser.java:393) ~attoparser-2.0.4.RELEASE.jar:2.0.4.thymeleaf在org.attoparser.MarkupParser.parse(MarkupParser.java:257) ~attoparser 2.0.4.thymeleaf. col :2.0.4.thymeleaf在org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230) ~19 MEFF-3.0.8 RELEASE.JAR:3.0.8.发布.102个常见的框架,由: org.thymeleaf.exceptions.TemplateProcessingException:异常计算SpringEL表达式:SpringEL(模板:“视图/programmazione/show”)-第92行,col 19)在org.thymeleaf.spring4.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:290) ~thymeleaf-spring4-3.0.8.RELEASE.jar:3.0.8.RELEASE

我的html页面如下:

代码语言:javascript
复制
<th:block th:each="prg, prgStat : *{programmazioneTransient}">
        <tr th:id="riga+${prgStat.index}">
            <td scope="col" style="width: 15%!important;">
                <input type="text" th:id="sperimentatore+${prgStat.index}" th:name="programmazioneTransient[+${prgStat.index}+].sperimentatore" class="text-center form-control-plaintext" readonly="readonly" th:value="${#strings.capitalizeWords(prg.sperimentatoreTransient)}"></input>
            </td>
            <td scope="col" style="width: 15%!important;">
                <input type="text" th:id="aiutoSperimentatore+${prgStat.index}" th:name="programmazioneTransient[+${prgStat.index}+].aiutoSperimentatore" class="text-center form-control-plaintext" readonly="readonly" th:value="${#strings.capitalizeWords(prg.aiutoSperimentatoreTransient)}"></input>
            </td>
                            ...
            <th:block th:each="v, vInd : *{programmazioneTransient+${prgStat.index}.varieTransient}" > 
                <td scope="col" >
                    <input type="number" th:id="v.quantita+*{#lists.size(programmazioneTransient)}" th:name="varieTransient[+${vInd.index}+].numeroProgrammate" class="text-center form-control-plaintext" readonly="readonly" th:value="varieTransient[+${vInd.index}+].numeroProgrammate"></input>
                </td>
            </th:block> 
        </tr> 
</th:block>

有什么建议吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-18 14:48:34

与其尝试索引,为什么不直接使用局部变量?

代码语言:javascript
复制
<th:block th:each="prg, prgStat : *{programmazioneTransient}">
    .
    .
    .
    <th:block th:each="v, vInd : ${prg.varieTransient}">
        .
        .
        .
    </th:block>
</th:block>

如果您确实想使用索引,您应该记住,一般来说,您不应该嵌套${...}表达式--除非是在特殊情况下。该表达式如下所示:

代码语言:javascript
复制
<th:block th:each="v, vInd : *{programmazioneTransient[prgStat.index].varieTransient}">
    .
    .
    .
</th:block>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50907016

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档