동일한 테이블 (다른 열)에 내용을 표시하려는 두 개의 배열이 있습니다. index
또는 사용하여 어레이를 어떻게 반복 할 수 있습니까?th:each
내가 이루고 싶은 것은
<table>
<tr>
<td>List1Elm1</td>
<td>List2Elm1</td>
</tr>
<tr>
<td>List1Elm2</td>
<td>List2Elm2</td>
</tr>
<tr>
<td>List1Elm3</td>
<td>List2Elm3</td>
</tr>
<tr>
<td>List1Elm4</td>
<td>List2Elm4</td>
</tr>
</table>
이 List1Elm1은 목록 1의 첫 번째 요소입니다.
두 개의 목록을 동시에 반복 할 수있는 방법은 없습니다. 그래서 사람이 할 수있는 것은 인덱스를 반복하고 인덱스를 사용하여 목록에 액세스하는 것입니다.
<tr th:each="index : ${#numbers.sequence( 0, #arrays.length(List1)-1)}">
<td th:text="${List1[index]>List1Elm1</td>
<td th:text="${List2[index]>List2Elm1</td>
</tr>
참고 :이 경우에만 작동합니다 ${...}
로 표현하지 *{...}
표현
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다