ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Thymeleaf 주석
    framework/Spring 2019. 5. 28. 19:08
    반응형

    1. standard html/xml comments

    표준 html/xml 주석( )은 thymeleaf templates 어디서나 사용가능하다. 이 주석 안에 어떤 것이 들어가더라도 백엔드에서나 프론트엔드에서 실제로 수행 되지 않는다. 단순히 결과에 그대로 복사될 뿐이다.

    <!-- comments about somthing -->


    2. Thymeleaf parser-level comment blocks

    parser-level comment block들은 thymeleaf가 문서를 파싱할 때 템플릿에서 제거되는 코드를 의미한다. thymeleaf는 이 블록 안에 있는 모든 것들을 완전하게 제거한다.

    <!--/* This code will be removed at thymeleaf parsing time! */-->


    3. Thymeleaf prototype-only comment blocks

     thymeleaf에는 템플릿이 static하게 보여질 때만 주석이 되는 특별한 주석 블록의이 존재한다.(이를 프로토 타입이라고 한다), 하지만 thymeleaf가 템플릿을 동적으로 실행했을 때는 주석처리가 되지 않고 그대로 보여지게 된다.

     <!--/*/
      <div th:text="${...}">
        ...
      </div>
    /*/-->


    4. th:block tag

    표준 방언 안에 포함된 thymeleaf의 유일한 요소 처리기는 th:block 이다. th:blockdms 단순히 템플릿 개발자가 그들이 원하는 어떤 속성이든 명시하는 속성 컨테이너이다. thymeleaf는 이 속성들을 실행하고 이 블록을 흔적도 없이 사라지게 만든다. 

    <table>
      <th:block th:each="user : ${users}">
        <tr>
            <td th:text="${user.login}">...</td>
            <td th:text="${user.name}">...</td>
        </tr>
        <tr>
            <td colspan="2" th:text="${user.address}">...</td>
        </tr>
      </th:block>
    </table>
    반응형
Designed by Tistory.