Unblocking The Main Thread Solving ANRs and Frozen Frames
Spring User Group Thymeleaf 08-21-2013
1. Credera is a full-service management and
technology consulting firm. Our clients range
from Fortune 1,000 companies to emerging
industry leaders. We provide expert, objective
advice to help solve complex business and
technology challenges.
Dallas Office
15303 Dallas Parkway
Suite 300
Addison, TX 75001
972.692.0010 Phone
972.692.0019 Fax
Denver Office
5445 DTC Parkway
Suite 1040
Greenwood Village, CO 80111
303.623.1344 Phone
303.484.4577 Fax
Houston Office
800 Town & Country Blvd
Suite 300
Houston, TX 77024
713.496.0711 Phone
713.401.9650 Fax
Austin Office
9020 N Capital of Texas Hwy
Suite 345
Austin, TX 78759
512.327.1112 Phone
512.233.0844 Fax
2. Discussion document – Strictly Confidential & Proprietary
Thymeleaf:
Better than JSP
Dallas, TX
August 21, 2013
3. August 21, 2013
Thymeleaf: Better than JSP
3
Agenda …
We will have a brief overview of Thymeleaf followed by a demonstration
Agenda
• What is Thymeleaf
• Comparison with JSP
• Demo
• References
5. August 21, 2013
Thymeleaf: Better than JSP
5
What is Thymeleaf…
Thymeleaf is a Java based XML/ XHTML/ HTML5 template engine
Core Features
• Supports several template modes
– XML, XHTML, HTML5
– Extendable to any template type that can be modeled using DOM
• Standard I18N support through properties files
• Modular feature sets supported as Dialects
• Attribute based processing
• Built in View Caching
Primary Integrations
• Standard Spring MVC Integration
– Support for Spring form binding and property editors
– Supports Internationalization through Spring MessageSource
• Apache Tiles
• Spring Security 3.x
• Eclipse IDE Autocomplete
6. August 21, 2013
Thymeleaf: Better than JSP
6
What is Thymeleaf…
Thymeleaf uses attribute based processing to allow for natural templating
What does it look like?
<table>
<thead>
<tr>
<th th:text="#{msgs.headers.name}">Name</th>
<th th:text="#{msgs.headers.price}">Price</th>
</tr>
</thead>
<tbody>
<tr th:each="prod : ${allProducts}">
<td th:text="${prod.name}">Oranges</td>
<td th:text="${#numbers.formatDecimal(prod.price,1,2)}">0.99</td>
</tr>
</tbody>
</table>
8. August 21, 2013
Thymeleaf: Better than JSP
8
Comparison with JSP
Thymeleaf is an easy to use template engine that serves as a drop in
replacement for JSP
Thymeleaf
• Attribute based processing
– Unobtrusive processing which allows
templates to be use as static templates
• Requires document to be valid XML
– Promotes well formed HTML and better
cross-browser compatibility
• Extensible through Dialects
• Built in support for I18N
• Standard module for Spring support
• Escapes dynamic text by default
• Unit Testing Framework
JSP(X)
• Tag based processing
– Processing is obtrusive and prevents use
as static templates
• Allows templates to be written in non-valid XML
– Allows not well formed HTML which can
have compatibility issues (JSP only)
• Extensible through Taglibs
• Supports I18N through fmt Taglib
• Supports Spring MVC through taglibs
• Escapes dynamic text through c:out tag