che*_*roz 2 java spring thymeleaf
我有一个数独生成器类,它以双数组 (int) 的形式返回 9x9 数独板,我试图循环遍历该数组并创建一个表,但我陷入困境,在 Thymeleaf 网站上找不到任何信息。
更新
感谢@Nikolas,让它工作了
<form id="sudokuBoard" method="post">
<table class="table table-dark">
<tr th:each="row: ${board}">
<td th:each="value: ${row}">
<div th:switch="${value}">
<input th:case="0" style="width:30px;height:30px;text-align:center" type = "text" maxlength="1" value="0">
<input th:case="*" style="width:30px;height:30px;text-align:center;background-color:lightgreen" type = "text" th:value="${value}" readonly>
</div>
</td>
</tr>
</table>
<input type="submit"> Check Solution </input>
</form>
Run Code Online (Sandbox Code Playgroud)
使用 2 个嵌套th:each命令:
<table>
<tr th:each="i: ${array}">
<td th:each="item: ${j}">
<span th:text="${item}"></span >
</td>
<tr>
</table>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2162 次 |
| 最近记录: |