관련 expression
l Simple expressions:
n Variable Expressions: ${...}
n Selection Variable Expressions: *{...}
u 사용 예 (th:object와 같이 선택[selection] 되어 있어야 한다.)
l <div th:object="${session.user}">
l <p>Name: <span th:text="*{firstName}">Sebastian</span>.</p>
l </div>
n Message Expressions: #{...}
n Link URL Expressions: @{...}
l Literals
n Text literals: 'one text', 'Another one!',...
n Number literals: 0, 34, 3.0, 12.3,...
n Boolean literals: true, false
n Null literal: null
n Literal tokens: one, sometext, main,...
l Text operations:
n String concatenation: +
n Literal substitutions: |The name is ${name}|
l Arithmetic operations:
n Binary operators: +, -, *, /, %
n Minus sign (unary operator): -
l Boolean operations:
n Binary operators: and, or
n Boolean negation (unary operator): !, not
l Comparisons and equality:
n Comparators: >, <, >=, <= (gt, lt, ge, le)
n Equality operators: ==, != (eq, ne)
l Conditional operators:
n If-then: (if) ? (then)
n If-then-else: (if) ? (then) : (else)
n Default: (value) ?: (defaultvalue)
u value가 null이면 deaufltvalue값을 사용하고 아니면 value값을 사용함
n 사용 예
u 'User is of type ' + (${user.isAdmin()} ? 'Administrator' : (${user.type} ?: 'Unknown'))
springframework과 연동하면
- th:field 를 <select><input><textarea>등에 넣으면 자동 binding 됨
- *{{newDate}}와 같이 double-bracket syntax를 사용하면 Spring Conversion Service가 자동 연동 된다.
참고내용
1. 기본적으로 볼 것(springframework을 사용하면 아래 2개는 모두 보고 사용하길 추천함.
두번째 링크에서 활용도 높은 새로운 기능 및 tag들이 있음)B. Using Thymeleaf - http://www.thymeleaf.org/doc/html/Using-Thymeleaf.html
C. Thymeleaf + spring 3 - http://www.thymeleaf.org/doc/html/Thymeleaf-Spring3.html
2. 참고로 볼 것
A. http://en.wikipedia.org/wiki/Thymeleaf
B. http://www.thymeleaf.org/thvsjsp.html
C. http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd
D. http://forum.thymeleaf.org/
E. 18. View technologies – Spring - http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/view.html