๐ LocalDateTime → 'YYYY-mm-dd'
<td class="tx_cnt" th:if="${list?.regDate != null}"
th:text="${#temporals.format(list.regDate, 'yyyy-MM-dd')}"></td>
- LocalDateTime/LocalDate ๋ #temporals ์ฌ์ฉํด์ ๋ณํ ๊ฐ๋ฅ.
๐ String → LocalDateTime → ๋ ์ง ํ์์ผ๋ก ๋ณํ
<td class="tx_cnt fs16" id="cert_date"
th:if="${result?.pubDate != null}"
th:text="${#temporals.createDate(result.pubDate, 'yyyyMMdd')}">
- temporals.createDate ๋ก LocalDate๋ก ๋ณํํ ๋ค yyyy-MM-dd String ๋ ์ง๋ก ๋ณํ.
๐ NULL ์ฒ๋ฆฌ
How to handle null values in Thymeleaf
<input type="hidden" id="cert_certId" th:value="**${result?.certId}"** name="certId">
- ? ์ฌ์ฉํด์ null์ฒ๋ฆฌ
- StringUtil ์ฌ์ฉํ๊ธฐ
- isEmpty
<td class="tx_cnt"
th:if="${not #strings.isEmpty(list?.applyStartDate)}"
th:text="${#temporals.createDate(list?.applyStartDate, 'yyyyMMdd')}">
? ์ฌ์ฉํด์ null ์ฒ๋ฆฌ ํด์ค๋ค.