Skill/spring

[thymeleaf] 문법

진열사랑 2023. 12. 6. 15:47

* application.properties 의 변수 접근 방법
${@environment.getProperty('browser.title')}

<title th:text="${@environment.getProperty('browser.title')}"></title>

* 문자열 비교
<dd th:text="${tidList.payName}? '제로페이':'서울페이'"></dd>

* 년도 선택
<select id="searchFromYear" name="searchFromYear" class="select2 form-control" th:with="start=2022, last=${#dates.year(#dates.createNow())}">
      <option th:each="i: ${ #numbers.sequence( start,last+1)}" th:value="${i}" th:text="${i}" th:selected="${i} == ${start}"></option>
</select>

* 매뉴얼
https://www.thymeleaf.org/apidocs/thymeleaf/2.1.6.RELEASE/org/thymeleaf/expression/Numbers.html