사용자 도구

사이트 도구


wiki:thymeleaf

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
wiki:thymeleaf [2022/10/31 20:39]
127.0.0.1 바깥 편집
wiki:thymeleaf [2023/03/29 10:17] (현재)
dhan
줄 23: 줄 23:
  
 ===== Operator(연산자) ===== ===== Operator(연산자) =====
-세이프 네비게이션 연산자 [?.]+==== 세이프 네비게이션 연산자 [?.] ====
 <code java> <code java>
 Person person = null;  Person person = null; 
줄 29: 줄 29:
 System.out.println(name); // null - NullPointerException을 던지지 않는다!!! System.out.println(name); // null - NullPointerException을 던지지 않는다!!!
 </code> </code>
-엘비스 연산자[?:]+==== 엘비스 연산자[?:====
 <code java> <code java>
 String name = null; String name = null;
줄 35: 줄 35:
 System.out.println(name); // 기본값 System.out.println(name); // 기본값
 </code> </code>
 +==== if - else 사용법 =====
 +<code jsp>
 +  <TAG th:if="조건문" ></TAG>
 +  <TAG th:unless ></TAG>
 +</code>
 +> 조건문은 무조건 동일하여 적어주어야 정상적으로 동작
 +
 +  * [[https://solbel.tistory.com/1406|[thymeleaf] 타임리프 if unless 사용법 및 예제]]
 +==== th:block 사용법 ====
 +테이블에서 2개 이상의 td를 효과적으로 커스터마이징 하고자할 때 \\
 +예를 들어 colspan이나 rowspan 적용시 사용하면 효과적임
 +<code jsp>
 +<th:block th:if="${pojo.f == null}">
 +    <td colspan="2" th:text="#{nice.info}"/>
 +</th:block>
 +<th:block th:if="${pojo.f != null}">
 +    <td th:text="${pojo.f}"/>
 +    <td th:text="${pojo.g}"/>
 +</th:block>
 +</code>
 +
 +
 +
 +===== Parameter ======
 +
 +  * [[https://attacomsian.com/blog/thymeleaf-get-query-string-parameters|How to get query string parameters in Thymeleaf]]
 +
 ===== Tip ===== ===== Tip =====
 이클립스 플러그인 설치:\\ 이클립스 플러그인 설치:\\
-  * Help >> Install New Software >>  http://www.thymeleaf.org/eclipse-plugin-update-site/  를 입력합니다.+  * Help >> Install New Software >>  http://www.thymeleaf.org/eclipse-plugin-update-site/ 를 입력합니다. 
 +\\
  
 +  * [[https://hyunsangwon93.tistory.com/19|Spring boot Thymeleaf 자주 사용하는 문법]]
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
 +**''리눅스''** 환경에서 Controller의 반환값 맨 앞에 /가 들어가 있으면 안됩니다. \\
 +thymeleaf 리졸버가 읽지를 못합니다.
 +  * [[https://wonin.tistory.com/503|[AWS] ec2 환경에서 thymleaf 오류 잡기(template might not exist or might not be accessible by any of the configured Template Resolvers...)]]
 \\ \\
  
/volume1/web/dokuwiki/data/attic/wiki/thymeleaf.1667216385.txt.gz · 마지막으로 수정됨: 2022/10/31 20:39 저자 127.0.0.1