티스토리 뷰

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>

* switch 사용예
<th:block th:switch="${EDIT_MODE}">
<button type="button"th:case="${T(com.shinhanpg.admin.backoffice.common.constants.GlobalConstants).MODE_INS}" >등록</button>
<button type="button" th:case="${T(com.shinhanpg.admin.backoffice.common.constants.GlobalConstants).MODE_UPD}" >수정</button>
</th:block>

* include fragment
// 호출 html
<th:block th:replace="client/clientMgmtFeeAfdpst :: FeeAfdpst"></th:block>
// clientMgmtFeeAfdpst.html
<th:block th:fragment="FeeAfdpst"></th:block>

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

'Skill > spring' 카테고리의 다른 글

java 제네릭 Raw Type 쓰면 안되는  (1) 2023.12.20
java Gson사용 예  (0) 2023.12.20
Request header is too large  (1) 2023.12.01
java poi 매뉴얼  (1) 2023.11.21
JVM DNS TTL 설정  (0) 2023.10.10
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함