2022/03/02 뷰,뷰 템플릿

김석진·2022년 3월 2일
0

타임리프

Thymeleaf

Thymeleaf is modern server-side Java templete engine for both web and standalone environments

Spring boot에서 밀어주는 뷰 템플릿이다! 실무에서는 자주 보이지 않는 템플릿이다 라고 강사님께서 말씀하셨다.

Thymeleaf 만의 특징,강점

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

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

템플릿 문법 적용 방법

3가지

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

Expressions

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

Literals

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

Text operations

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

Arithmetic operations

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

Boolean operations

  • Binary operators :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-else: (if)?(then):(else)
  • Default :(value)?:(defaultvalue)

Special tokens

  • No-Operation:_텍스트
profile
주니어 개발자 되고싶어요

0개의 댓글