th:abbr |
th:accept |
th:accept-charset |
th:accesskey |
th:action |
th:align |
th:alt |
th:archive |
th:audio |
th:autocomplete |
th:axis |
th:background |
th:bgcolor |
th:border |
th:cellpadding |
th:cellspacing |
th:challenge |
th:charset |
th:cite |
th:class |
th:classid |
th:codebase |
th:codetype |
th:cols |
th:colspan |
th:compact |
th:content |
th:contenteditable |
th:contextmenu |
th:data |
th:datetime |
th:dir |
th:draggable |
th:dropzone |
th:enctype |
th:for |
th:form |
th:formaction |
th:formenctype |
th:formmethod |
th:formtarget |
th:fragment |
th:frame |
th:frameborder |
th:headers |
th:height |
th:high |
th:href |
th:hreflang |
th:hspace |
th:http-equiv |
th:icon |
th:id |
th:inline |
th:keytype |
th:kind |
th:label |
th:lang |
th:list |
th:longdesc |
th:low |
th:manifest |
th:marginheight |
th:marginwidth |
th:max |
th:maxlength |
th:media |
th:method |
th:min |
th:name |
th:onabort |
th:onafterprint |
th:onbeforeprint |
th:onbeforeunload |
th:onblur |
th:oncanplay |
th:oncanplaythrough |
th:onchange |
th:onclick |
th:oncontextmenu |
th:ondblclick |
th:ondrag |
th:ondragend |
th:ondragenter |
th:ondragleave |
th:ondragover |
th:ondragstart |
th:ondrop |
th:ondurationchange |
th:onemptied |
th:onended |
th:onerror |
th:onfocus |
th:onformchange |
th:onforminput |
th:onhashchange |
th:oninput |
th:oninvalid |
th:onkeydown |
th:onkeypress |
th:onkeyup |
th:onload |
th:onloadeddata |
th:onloadedmetadata |
th:onloadstart |
th:onmessage |
th:onmousedown |
th:onmousemove |
th:onmouseout |
th:onmouseover |
th:onmouseup |
th:onmousewheel |
th:onoffline |
th:ononline |
th:onpause |
th:onplay |
th:onplaying |
th:onpopstate |
th:onprogress |
th:onratechange |
th:onreadystatechange |
th:onredo |
th:onreset |
th:onresize |
th:onscroll |
th:onseeked |
th:onseeking |
th:onselect |
th:onshow |
th:onstalled |
th:onstorage |
th:onsubmit |
th:onsuspend |
th:ontimeupdate |
th:onundo |
th:onunload |
th:onvolumechange |
th:onwaiting |
th:optimum |
th:pattern |
th:placeholder |
th:poster |
th:preload |
th:radiogroup |
th:rel |
th:rev |
th:rows |
th:rowspan |
th:rules |
th:sandbox |
th:scheme |
th:scope |
th:scrolling |
th:size |
th:sizes |
th:span |
th:spellcheck |
th:src |
th:srclang |
th:standby |
th:start |
th:step |
th:style |
th:summary |
th:tabindex |
th:target |
th:title |
th:type |
th:usemap |
th:value |
th:valuetype |
th:vspace |
th:width |
th:wrap |
th:xmlbase |
th:xmllang |
th:xmlspace |
th:async |
th:autofocus |
th:autoplay |
th:checked |
th:controls |
th:declare |
th:default |
th:defer |
th:disabled |
th:formnovalidate |
th:hidden |
th:ismap |
th:loop |
th:multiple |
th:novalidate |
th:nowrap |
th:open |
th:pubdate |
th:readonly |
th:required |
th:reversed |
th:scoped |
th:seamless |
th:selected |
let’s see a quick summary of the Standard
Expression features:
·
Simple expressions:
o Variable Expressions: ${...}
o Selection Variable Expressions: *{...}
o Message Expressions: #{...}
o Link URL Expressions: @{...}
o Fragment Expressions: ~{...}
·
Literals
o Text literals: 'one text', 'Another one!',…
o Number literals: 0, 34, 3.0, 12.3,…
o Boolean literals: true, false
o Null literal: null
o Literal tokens: one, sometext, main,…
·
Text operations:
o String concatenation: +
o Literal substitutions: |The name is ${name}|
·
Arithmetic operations:
o Binary operators: +, -, *, /, %
o Minus sign (unary operator): -
·
Boolean operations:
o Binary operators: and, or
o Boolean negation (unary operator): !, not
·
Comparisons and
equality:
o Comparators: >, <, >=, <= (gt, lt, ge, le)
o Equality operators: ==, != (eq, ne)
·
Conditional operators:
o If-then: (if) ? (then)
o If-then-else: (if) ? (then) : (else)
o Default: (value) ?:
(defaultvalue)
·
Special tokens:
Attribute |
Examples |
Description |
th:text |
<h1 th:text="${post.title}">Title</h1> |
displaying
HTML-encoded text that is evaluated from the expression |
th:utext |
<div
th:utext="${post.content}">Content</div> |
displays text
unescaped |
th:attr |
Single: |
sets the value of
attribute |
th:attrappend |
<input type="button" value="Do it!"
class="btn" th:attrappend="class=${' ' + cssStyle}" /> |
appends the value to
existing attribute |
th:each |
<tr th:each="customer, custStat :
${customers}"> |
iteration
attribute |
th:if |
<div th:if="${user.isAdmin()}">...</div> |
evaluates the
conditions specified in the attribute and if they are true, the tag is
displayed |
th:unless |
<div th:unless="${user.isAdmin()}">.not
admin..</div> |
the opposite
of th:if |
th:switch, th:case |
<div th:switch="${user.role}"> |
creating a switch
statement |
th:label, th:action,
th:href, th:onclick etc. |
<form th:action="@{/sampleInputs}"
th:object="${sampleInputs}" method="post"> |
those attributes can
be used as a shorthand of the th:attr syntax |
th:with |
<div th:with="firstPer=${persons[0]}"> |
defining local
variables |
No comments:
Post a Comment