gpt4 book ai didi

thymeleaf - 使用 thymeleaf 在 中获取数据

转载 作者:行者123 更新时间:2023-12-02 03:08:26 24 4
gpt4 key购买 nike

这是我的代码片段:

<th:block th:each="d : ${items}">
<!--<tr>-->
<td th:text="${d.productname}"></td>
<td th:text="${d.quantity}"></td>
<td th:text="${d.price}"></td>
<!--</tr>-->
</th:block>

items 是一个 ArrayList。
如果 tr 不存在,我可以获取数据(如您所见,我在代码中对其进行了注释)。
如果我把它们放回去,我的 th:text 会得到 null 值。我也尝试了 tr th:each 但它没有帮助。

我该如何解决这个问题?谢谢。

最佳答案

我正在使用 thymeleaf-3.0.0,它对我有用。

    <table>
<tr th:each="d : ${items}" >
<td th:text="${d.productname}"></td>
<td th:text="${d.quantity}"></td>
<td th:text="${d.price}"></td>
</tr>
</table>

关于thymeleaf - 使用 thymeleaf 在 <tr> 中获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41121159/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com