Thymeleaf

김주영·2023년 9월 13일

Thymeleaf의 특징

HTML5 웹 표준을 준수하는 템플릿

  • 전체적인 문법이 HTML5 마크업 표준을 최대한 해치지 않게끔 설계
  • Decoupled logic : 템플릿 문법을 아예 템플릿에서 분리 가능
    - 순수한 마크업만 남음 -> 템플릿 엔진이 작동하지 않아도 렌더링되는 정적 목업 페이지
    - 디자이너가 이해하기 쉬운 코드

템플릿 문법 적용 방법 3가지

  • "th:" tag
  • "data-th-" attribute
  • decoupled logic

Expressions

  • Vatiable Expressions : ${...}
  • Selection Vatiable Expressions : *{...}
  • Message Expressions : #{...}
  • Link URL Expressions : @{...}
  • Fragment Expressions : ~{...}

Literals

  • Text literals : 'one text','Another one!',...
  • Number literals : 0,34,3.0,12.3,...
  • Null literals : true, false
  • Null literal : null
  • Literal tokens : one, sometext, main,...

Text operations

  • String concatenation : +
  • Literal substitutions : |The name is ${name}|

Arithmetic operations

  • Binary operators : +,-,*,/,%
  • Minus sign (unary operator) : -

Boolean operations

  • Binary operator : and, or
  • Boolean negation (unary operator) : !, not

Comparisons and equality

  • Comparators : >, <, >=, <= (gt, lt, ge, le)
  • Equality operators : ==, != (eq, ne)

Conditional operators

  • if-then : (if) ? (then)
  • if-then : (if) ? (then) : (else)
  • Default : (value) ?: (defaultvalue)

Special tokens

  • No-Operation : _

구글 트렌드

  • 한국 트렌드

  • 전세계 트렌드

0개의 댓글