设置多个变量值并在thymleaf中执行减法

时间:2018-04-05 12:41:10

标签: java spring-boot thymeleaf

我是Thymeleaf的新手,我尝试从总金额中减去列支付金额的值,但给出如下错误: error that i get on browser

如果我评论Remaining amount列,我会得到以下结果: if I comment Remaining amount column i get this result

<div th:if="${not #lists.isEmpty(cust)}">
            <table border="1" style="width: 300px">
              <thead>
                <tr>
                    <th>Name</th>
                    <th>Address</th>
                    <th>Phone</th>
                    <th>Total Amount</th>
                    <th>Paid Amount</th>
                    <th>Remaining Amount</th>
                </tr>
                </thead>
                <tbody>

                <tr th:each="customer : ${cust}">
                    <td th:text="${customer.name}"></td>
                    <td th:text="${customer.address}"></td>
                    <td th:text="${customer.phone}"></td>
                    <td
                        th:with="result1=${#aggregates.sum(customer.customerDetails.![totalAmount])}">
                        <span th:text="${result1}"></span>
                    </td>
                    <td
                        th:with="result3=${#aggregates.sum(customer.payment.![paidAmount])}">
                        <span th:text="${result3}"></span>
                    </td>
                     <td th:with="result=${#aggregates.sum(customer.customerDetails.![totalAmount])}, result2=${#aggregates.sum(customer.payment.![paidAmount])}">
                    <span th:text="${result}- ${result2}"></span>
                    </td>
                </tr>
                </th:block>
                </tbody>
            </table>
        </div>

0 个答案:

没有答案