th:text
태그안에 들어가는 텍스트값.
<span th:text="${evenFvrDtl.winRnkg}"></span>
th:if, th:unless, th:value
th:if 는 if, th:unless 는 else표현.
th:value는 태그안의 value이다.
<th:block th:if="${evenPtcpPsbOrdData != null && #lists.size(evenPtcpPsbOrdData.eventPtcpOrdInfoList) > 0}">
<input type="hidden" id="ibx_TotalPurAplAmt" th:value="${totalPurAplAmt}"/>
</th:block>
<th:block th:unless=${eventPtcpPsbOrdData != null && #lists.size(eventPtcpPsbOrdData.eventPtcpOrdInfoList) > 0}">
<input type="hidden" id="ibx_TotalPruAplAmt" value="0"/>
</th:block>
th:utext(unescaped text)
<div></div>같은 태그 형식의 코드를 삽입하고 싶을 때 사용
태그 형식의 텍스트 들어올 시 태그로 인식
<!-- HTML 컨텐츠 영역 -->
<th:block th:utext="${#camaignUtils.unescapeHtml(eventDispTempleteInfo.htmlContents)}"></th:block>
th:with
변수 형태의 값을 재정의 한 것.
stnmZipNo의 변수를 값이 있다면 정의하고 없다면 공백으로 정의.
<th:block th:with="stnmZipNo=${#strings.defaultString(ecCustInfo.stnmZipNo, '')}">
</th:block>
th:switch, th:case
switch case문과 같다.
fvrDvsCd값이 이럴때 case1, case2로 빠지고
그 외의 것은 th:case=*로 빠지게 된다.
<div th:switch="${eventFvrDtl.fvrDvsCd}" class="coupon_gift">
<p th:case="${#foConstants.FVR_DVS_CD_DISCOUNT}" class="cp cptype02">
<th:block th:switch="${fvrKnd2Cd}">
<span th:case="${#foConstants.FVR_KND2_CD_FREE_DLV_CPN}" th:text="${fvrKnd2CdNm}" class="tx"></span>
<span th:case="*" class="tx">
<th:block th:text="${fvrKnd2CdNm}"></th:block>
<span>
<th:block>
</p>
<p th:case="${#foConstants.FVR_DVS_CD_ACCUMULATION}" class="cp cptype02">
<span class="ty" th:text="${fvrKnd2CdNm}"></span>
<span class="tx" th:text="${#numbers.formatInteger(eventFvrDtl.fvrDtlCnts, 3, 'COMMA')}"></span>
</p>
<p th:case="*" class="cp cptype02">
<span class="tx" th:text="${eventFvrDtl.fvrDtlCnts}"></span>
</p>
</div>
th:fragment
include와 비슷하다.
특정 영역을 가져와서 나타낼 수 있다.
예를 들어 페이지마다 각각의 게시판을 가지고 싶은 경우
포함하는 곳.
ex)eventPage1.html
<th:block th:if="$#lists.size(eventDispTemplateCornerList)} > 0" th:each="eventDispTemplateCorner : ${eventDispTemplateCornerList}">
<!-- 이벤트 템플릿 코너 -->
<th:block th:include="${eventDispTemplateCorner.cmpnTmplFileUrl} :: corner (${eventDispTemplateCorner.cmpnNo}, ${eventDate.eventBaseInfo.eventPtcpPsbYn})"></th:block>
</th:block>
받는곳
ex)board.html
<th:block th:fragment="corner (cmpnNo, eventPtcpPsbYn)">
<div class="content_title noline">
<p class="title">게시판</p>
</div>
</th:block>
controller를 거쳐 화면으로 가져온 데이터를 스트립트로 제어할 때
//controller
ModelAndView mv;
mv.addObject("eventData", eventData);
return mv
//controller를 거쳐 화면으로 가져온 데이터를 스크립트로 제어할 때
var data1 = [[${eventData}]];
var eventPtcpPsbYn = [[${#strings.defaultString(eventData.eventBaseInfo.eventPtcpPsbYn, 'Y')}]];
태그안의 attribute를 타임리프로 정의할 때
//태그안의 attribute를 타임리프로 정의할 때
<div id="myDiv1" th:attr="usemap=|#E_${eventDate.eventBaseInfo.cmpnNo}|">
</div>
//정의된 결과
<div id="myDiv1" usemap="#E_21082">
</div>
'Project&문제해결' 카테고리의 다른 글
6월 4일 에러 (thehouseProject) (0) | 2020.06.05 |
---|---|
6월 3일 에러 (thehouseProject) (0) | 2020.06.03 |
6월 2일 에러(houseProject) (0) | 2020.06.03 |
intelliJ 오류 (0) | 2020.06.01 |
이미지썸네일 (0) | 2020.05.27 |