Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 在Thymeleaf中打印值_Spring Boot_Thymeleaf - Fatal编程技术网

Spring boot 在Thymeleaf中打印值

Spring boot 在Thymeleaf中打印值,spring-boot,thymeleaf,Spring Boot,Thymeleaf,我想在Thymeleaf中的迭代中传递一个整数值。我们如何在thymeleaf实现这一点 <tr th:each="client : ${clients}"> <td th:text="${client.name}"></td> <td th:text="${client.contactPersonName}"></td>

我想在Thymeleaf中的迭代中传递一个整数值。我们如何在thymeleaf实现这一点

<tr th:each="client : ${clients}">
            <td th:text="${client.name}"></td>
            <td th:text="${client.contactPersonName}"></td>
            <td th:text="${client.phone}"></td>
            <td th:text="${client.email}"></td>
            <td th:text="${client.databases.name}"></td>
            <td onclick="deleteConfirmation(${client.id}">Delete</td>
</tr>

删除
这更像是我们如何在html上打印任何值

<p>${anyVariableViaController}</p>
${anyVariableViaController}

变量有一个
索引和一个
计数(分别从0和1开始)


删除

这是否回答了您的问题?
<tr th:each="client, status : ${clients}">
  <!-- starting from 0 -->
  <td th:text="${status.count}" />

  <!-- starting from 1 -->
  <td th:text="${status.index}" />

  <td th:text="${client.name}"></td>
  <td th:text="${client.contactPersonName}"></td>
  <td th:text="${client.phone}"></td>
  <td th:text="${client.email}"></td>
  <td th:text="${client.databases.name}"></td>
  <td onclick="deleteConfirmation(${client.id}">Delete</td>
</tr>