gwooden_코린이
스프링 부트 타임리프 사용해보기 본문
728x90
타임리프 - HTML을 동적화면으로 처리해주기 위한 라이브러리
<table>
<tr>
<th>아이디</th>
<th>제목</th>
<th>작성일</th>
</tr>
<tr th:each="question, loop : ${questionList}">
<td th:text="${question.id}"></td>
<td th:text="${question.subject}"></td>
<td th:text="${question.createDate}"></td>
<td th:text="${loop.index}"></td>
<!--count : 반복 횟수 | size : 개수 | first : 첫번째면 true 아니면 false | last : 마지막이면 true 아니면 false-->
<!--odd : 반복 횟수가 짝수면 true 홀수면 false | even : 짝수면 false 홀수면 true-->
<td th:switch="${question.id}">
<spqn th:case="1">일</spqn>
<spqn th:case="*">나머지</spqn>
</td>
<td th:if="${question.id == 1}" th:text="일이다"></td>
<td th:unless="${question.id == 1}" th:text="일이아님"></td>
</tr>
</table>
728x90
'스프링 부트' 카테고리의 다른 글
스프링 부트 시큐리티 + H2-CONSOLE (0) | 2023.02.15 |
---|---|
스프링 부트 유효성 검사 (0) | 2023.02.15 |
스프링 부트 DAO Respository (0) | 2023.02.13 |
스프링 부트 DB구축을 위한 JPA 활용 (0) | 2023.02.13 |
스프링 부트에서 롬복(lombok) 다운로드 및 사용해보기 (0) | 2023.02.13 |
Comments