@RequiredArgsConstructor : final로 생성자 생성th: <!-- null아니라면 표시 -->
<tr th:if="${question != null}">
<!-- questionList의 개수만큼 반복하여 출력 -->
<!-- 자바의 for each문과 유사 -->
<tr th:each="question : ${questionList}">
<!-- loop객체 이용 -->
<tr th:each="question, loop : ${questionList}">
| 항목 | 설명 |
|---|---|
| loop.index | 반복 순서, 0부터 1씩 증가 |
| loop.count | 반복 순서, 1부터 1씩 증가 |
| loop.size | 반복 객체의 요소 갯수 (예: questionList의 요소 갯수) |
| loop.first | 루프의 첫번째 순서인 경우 true |
| loop.last | 루프의 마지막 순서인 경우 true |
| loop.odd | 루프의 홀수번째 순서인 경우 true |
| loop.even | 루프의 짝수번째 순서인 경우 true |
| loop.current | 현재 대입된 객체 (예: 위의 경우 question과 동일) |
th:text=값 : 해당 텍스트 값으로 출력<tr th:text="${question.subject}">
<tr th:each="question : ${questionList}">
<td>[[${question.subject}]]</td>
<td>[[${question.createDate}]]</td>
</tr>
@Service 사용