SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
Introducing Thymeleaf 
2014/10/17 Template Engine Night at Pixiv 
@eiryu
Who am I? 
● Twitter @eiryu 
○ http://eiryu.com 
● Background 
○ Web application engineer 
■ Java 
● Spring Framework 
■ Groovy 
■ JavaScript 
■ PostgreSQL 
● Nowadays 
○ Infrastructure engineer 
○ Infomation system
What is Thymeleaf? 
● “Thymeleaf is a Java library. It is an XML / 
XHTML / HTML5 template engine” 
● Designer friendly 
● Powerful Spring Framework integration 
● JSP killer
How to use? 
● Prepend “th:” to HTML attributes 
● Use “th:text” if you replace textnode
At a glance 
(Demo)
Basics 
<span th:text="${name}">bob</span> 
<input type="text" value="red" 
th:value="blue"/>
Conditional Evaluation 
<button th:if=”${registered}”>clear</button> 
<button th:unless=”${registered}”>register</button>
Iteration 
<tr th:each=”user : ${users}”> 
<td th:text=”${user.name}”>name</td> 
<td th:text=”${user.age}”>age</td> 
</tr>
JavaScript inlining 
● /*[[...]]*/ expression 
var endpoint = /*[[@{/user/}]]*/ ‘default’; 
● JavaBeans to JSON 
var user = /*[[${user}]]*/ ‘{}’ 
↓ 
var user = {‘name’:’bob’, ‘age’:20};
i18n 
1. Prepare properties files 
○ Messages_en.properties 
■ hello=hello 
○ Messages_fr.properties 
■ hello=bonjour 
2. Specify key in #{...} expression 
e.g.) locale=fr_FR 
<h1 th:text=”#{hello}”>hello</h1> 
↓ 
<h1>bonjour</h1>
fin

Contenu connexe

Tendances

Advanced javascript with eZ Publish
Advanced javascript with eZ PublishAdvanced javascript with eZ Publish
Advanced javascript with eZ PublishDavid Hohl
 
Ch. 9 jsp standard tag library
Ch. 9 jsp standard tag libraryCh. 9 jsp standard tag library
Ch. 9 jsp standard tag libraryManolis Vavalis
 
How to learn to build your own PHP framework
How to learn to build your own PHP frameworkHow to learn to build your own PHP framework
How to learn to build your own PHP frameworkDinh Pham
 
Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWP Engine UK
 
Testing JavaScript with Jasmine in Rails Applications
Testing JavaScript with Jasmine in Rails Applications Testing JavaScript with Jasmine in Rails Applications
Testing JavaScript with Jasmine in Rails Applications Hector Correa
 
The Django Book - Chapter 5: Models
The Django Book - Chapter 5: ModelsThe Django Book - Chapter 5: Models
The Django Book - Chapter 5: ModelsSharon Chen
 
Django and Mongoengine
Django and MongoengineDjango and Mongoengine
Django and Mongoengineaustinpublic
 
Loops PHP 04
Loops PHP 04Loops PHP 04
Loops PHP 04Spy Seat
 
Introduction To JavaScript Ajax
Introduction To JavaScript AjaxIntroduction To JavaScript Ajax
Introduction To JavaScript AjaxReema
 
Introduction To JavaScript
Introduction To JavaScriptIntroduction To JavaScript
Introduction To JavaScriptReema
 
Automation - fabric, django and more
Automation - fabric, django and moreAutomation - fabric, django and more
Automation - fabric, django and moreIlian Iliev
 
Pourquoi WordPress n’est pas un CMS
Pourquoi WordPress n’est pas un CMSPourquoi WordPress n’est pas un CMS
Pourquoi WordPress n’est pas un CMSThomas Gasc
 

Tendances (20)

symfony & jQuery (phpDay)
symfony & jQuery (phpDay)symfony & jQuery (phpDay)
symfony & jQuery (phpDay)
 
Java script
Java scriptJava script
Java script
 
Ch. 7 beeing a jsp
Ch. 7 beeing a jsp     Ch. 7 beeing a jsp
Ch. 7 beeing a jsp
 
Ch. 8 script free pages
Ch. 8 script free pagesCh. 8 script free pages
Ch. 8 script free pages
 
Advanced javascript with eZ Publish
Advanced javascript with eZ PublishAdvanced javascript with eZ Publish
Advanced javascript with eZ Publish
 
Ch. 9 jsp standard tag library
Ch. 9 jsp standard tag libraryCh. 9 jsp standard tag library
Ch. 9 jsp standard tag library
 
How to learn to build your own PHP framework
How to learn to build your own PHP frameworkHow to learn to build your own PHP framework
How to learn to build your own PHP framework
 
Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST API
 
Tango with django
Tango with djangoTango with django
Tango with django
 
Testing JavaScript with Jasmine in Rails Applications
Testing JavaScript with Jasmine in Rails Applications Testing JavaScript with Jasmine in Rails Applications
Testing JavaScript with Jasmine in Rails Applications
 
The Django Book - Chapter 5: Models
The Django Book - Chapter 5: ModelsThe Django Book - Chapter 5: Models
The Django Book - Chapter 5: Models
 
Wt unit 5
Wt unit 5Wt unit 5
Wt unit 5
 
Django and Mongoengine
Django and MongoengineDjango and Mongoengine
Django and Mongoengine
 
Django Mongodb Engine
Django Mongodb EngineDjango Mongodb Engine
Django Mongodb Engine
 
Loops PHP 04
Loops PHP 04Loops PHP 04
Loops PHP 04
 
Introduction To JavaScript Ajax
Introduction To JavaScript AjaxIntroduction To JavaScript Ajax
Introduction To JavaScript Ajax
 
Introduction To JavaScript
Introduction To JavaScriptIntroduction To JavaScript
Introduction To JavaScript
 
J Query
J QueryJ Query
J Query
 
Automation - fabric, django and more
Automation - fabric, django and moreAutomation - fabric, django and more
Automation - fabric, django and more
 
Pourquoi WordPress n’est pas un CMS
Pourquoi WordPress n’est pas un CMSPourquoi WordPress n’est pas un CMS
Pourquoi WordPress n’est pas un CMS
 

En vedette

Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVCDzmitry Naskou
 
Thymeleafでハマったこと
ThymeleafでハマったことThymeleafでハマったこと
Thymeleafでハマったことeiryu
 
Thymeleafのすすめ
ThymeleafのすすめThymeleafのすすめ
Thymeleafのすすめeiryu
 
Fun With Spring Security
Fun With Spring SecurityFun With Spring Security
Fun With Spring SecurityBurt Beckwith
 
Spring User Group Thymeleaf 08-21-2013
Spring User Group Thymeleaf 08-21-2013Spring User Group Thymeleaf 08-21-2013
Spring User Group Thymeleaf 08-21-2013Justin Munn
 
DSpace UI Prototype Challenge: Spring Boot + Thymeleaf
DSpace UI Prototype Challenge: Spring Boot + ThymeleafDSpace UI Prototype Challenge: Spring Boot + Thymeleaf
DSpace UI Prototype Challenge: Spring Boot + ThymeleafTim Donohue
 
Comparing JVM Web Frameworks - February 2014
Comparing JVM Web Frameworks - February 2014Comparing JVM Web Frameworks - February 2014
Comparing JVM Web Frameworks - February 2014Matt Raible
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!Jakub Kubrynski
 
OAuth2 and Spring Security
OAuth2 and Spring SecurityOAuth2 and Spring Security
OAuth2 and Spring SecurityOrest Ivasiv
 
REST with Spring Boot #jqfk
REST with Spring Boot #jqfkREST with Spring Boot #jqfk
REST with Spring Boot #jqfkToshiaki Maki
 
ORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewBrett Meyer
 
Overview of JPA (Java Persistence API) v2.0
Overview of JPA (Java Persistence API) v2.0Overview of JPA (Java Persistence API) v2.0
Overview of JPA (Java Persistence API) v2.0Bryan Basham
 

En vedette (20)

Thymeleaf, will it blend?
Thymeleaf, will it blend?Thymeleaf, will it blend?
Thymeleaf, will it blend?
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 
Thymeleafでハマったこと
ThymeleafでハマったことThymeleafでハマったこと
Thymeleafでハマったこと
 
Thymeleafのすすめ
ThymeleafのすすめThymeleafのすすめ
Thymeleafのすすめ
 
Fun With Spring Security
Fun With Spring SecurityFun With Spring Security
Fun With Spring Security
 
Spring User Group Thymeleaf 08-21-2013
Spring User Group Thymeleaf 08-21-2013Spring User Group Thymeleaf 08-21-2013
Spring User Group Thymeleaf 08-21-2013
 
DSpace UI Prototype Challenge: Spring Boot + Thymeleaf
DSpace UI Prototype Challenge: Spring Boot + ThymeleafDSpace UI Prototype Challenge: Spring Boot + Thymeleaf
DSpace UI Prototype Challenge: Spring Boot + Thymeleaf
 
Java™ in Web 2.0
Java™ in Web 2.0Java™ in Web 2.0
Java™ in Web 2.0
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Comparing JVM Web Frameworks - February 2014
Comparing JVM Web Frameworks - February 2014Comparing JVM Web Frameworks - February 2014
Comparing JVM Web Frameworks - February 2014
 
Introduction to JPA Framework
Introduction to JPA FrameworkIntroduction to JPA Framework
Introduction to JPA Framework
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
OAuth2 and Spring Security
OAuth2 and Spring SecurityOAuth2 and Spring Security
OAuth2 and Spring Security
 
REST with Spring Boot #jqfk
REST with Spring Boot #jqfkREST with Spring Boot #jqfk
REST with Spring Boot #jqfk
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernate
 
ORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate Overview
 
Overview of JPA (Java Persistence API) v2.0
Overview of JPA (Java Persistence API) v2.0Overview of JPA (Java Persistence API) v2.0
Overview of JPA (Java Persistence API) v2.0
 

Similaire à Introducing thymeleaf

Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8Tatsuhiko Miyagawa
 
Python: an introduction for PHP webdevelopers
Python: an introduction for PHP webdevelopersPython: an introduction for PHP webdevelopers
Python: an introduction for PHP webdevelopersGlenn De Backer
 
Use Web Skills To Build Mobile Apps
Use Web Skills To Build Mobile AppsUse Web Skills To Build Mobile Apps
Use Web Skills To Build Mobile AppsNathan Smith
 
FYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III JavascriptFYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III JavascriptArti Parab Academics
 
XPath for web scraping
XPath for web scrapingXPath for web scraping
XPath for web scrapingScrapinghub
 
Drupal7 Theming session on the occassion of Drupal7 release party in Delhi NCR
Drupal7 Theming session on the occassion of  Drupal7 release party in Delhi NCRDrupal7 Theming session on the occassion of  Drupal7 release party in Delhi NCR
Drupal7 Theming session on the occassion of Drupal7 release party in Delhi NCRGaurav Mishra
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSPablo Godel
 
Don't you (forget about me) - PHP Meetup Lisboa 2023
Don't you (forget about me) - PHP Meetup Lisboa 2023Don't you (forget about me) - PHP Meetup Lisboa 2023
Don't you (forget about me) - PHP Meetup Lisboa 2023Bernd Alter
 
Introduction to javaScript
Introduction to javaScriptIntroduction to javaScript
Introduction to javaScriptNeil Ghosh
 
Turbogears Presentation
Turbogears PresentationTurbogears Presentation
Turbogears Presentationdidip
 

Similaire à Introducing thymeleaf (20)

Introduccion a HTML5
Introduccion a HTML5Introduccion a HTML5
Introduccion a HTML5
 
html5
html5html5
html5
 
Web Scrapping with Python
Web Scrapping with PythonWeb Scrapping with Python
Web Scrapping with Python
 
Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8
 
Svelte JS introduction
Svelte JS introductionSvelte JS introduction
Svelte JS introduction
 
Mustache
MustacheMustache
Mustache
 
More about PHP
More about PHPMore about PHP
More about PHP
 
Python: an introduction for PHP webdevelopers
Python: an introduction for PHP webdevelopersPython: an introduction for PHP webdevelopers
Python: an introduction for PHP webdevelopers
 
Use Web Skills To Build Mobile Apps
Use Web Skills To Build Mobile AppsUse Web Skills To Build Mobile Apps
Use Web Skills To Build Mobile Apps
 
FYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III JavascriptFYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III Javascript
 
XPath for web scraping
XPath for web scrapingXPath for web scraping
XPath for web scraping
 
Drupal7 Theming session on the occassion of Drupal7 release party in Delhi NCR
Drupal7 Theming session on the occassion of  Drupal7 release party in Delhi NCRDrupal7 Theming session on the occassion of  Drupal7 release party in Delhi NCR
Drupal7 Theming session on the occassion of Drupal7 release party in Delhi NCR
 
Java script
Java scriptJava script
Java script
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
 
Web::Scraper
Web::ScraperWeb::Scraper
Web::Scraper
 
Don't you (forget about me) - PHP Meetup Lisboa 2023
Don't you (forget about me) - PHP Meetup Lisboa 2023Don't you (forget about me) - PHP Meetup Lisboa 2023
Don't you (forget about me) - PHP Meetup Lisboa 2023
 
Introduction to javaScript
Introduction to javaScriptIntroduction to javaScript
Introduction to javaScript
 
Turbogears Presentation
Turbogears PresentationTurbogears Presentation
Turbogears Presentation
 
Playing With The Web
Playing With The WebPlaying With The Web
Playing With The Web
 
JSP Technology II
JSP Technology IIJSP Technology II
JSP Technology II
 

Plus de eiryu

Javaでのバリデーション 〜Bean Validation篇〜
Javaでのバリデーション 〜Bean Validation篇〜Javaでのバリデーション 〜Bean Validation篇〜
Javaでのバリデーション 〜Bean Validation篇〜eiryu
 
Ninja framework使ってみた
Ninja framework使ってみたNinja framework使ってみた
Ninja framework使ってみたeiryu
 
JMeter小話
JMeter小話JMeter小話
JMeter小話eiryu
 
最近のJavaでの開発について
最近のJavaでの開発について最近のJavaでの開発について
最近のJavaでの開発についてeiryu
 
TwFavView
TwFavViewTwFavView
TwFavVieweiryu
 
Spring小話
Spring小話Spring小話
Spring小話eiryu
 

Plus de eiryu (6)

Javaでのバリデーション 〜Bean Validation篇〜
Javaでのバリデーション 〜Bean Validation篇〜Javaでのバリデーション 〜Bean Validation篇〜
Javaでのバリデーション 〜Bean Validation篇〜
 
Ninja framework使ってみた
Ninja framework使ってみたNinja framework使ってみた
Ninja framework使ってみた
 
JMeter小話
JMeter小話JMeter小話
JMeter小話
 
最近のJavaでの開発について
最近のJavaでの開発について最近のJavaでの開発について
最近のJavaでの開発について
 
TwFavView
TwFavViewTwFavView
TwFavView
 
Spring小話
Spring小話Spring小話
Spring小話
 

Dernier

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Dernier (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Introducing thymeleaf

  • 1. Introducing Thymeleaf 2014/10/17 Template Engine Night at Pixiv @eiryu
  • 2. Who am I? ● Twitter @eiryu ○ http://eiryu.com ● Background ○ Web application engineer ■ Java ● Spring Framework ■ Groovy ■ JavaScript ■ PostgreSQL ● Nowadays ○ Infrastructure engineer ○ Infomation system
  • 3. What is Thymeleaf? ● “Thymeleaf is a Java library. It is an XML / XHTML / HTML5 template engine” ● Designer friendly ● Powerful Spring Framework integration ● JSP killer
  • 4. How to use? ● Prepend “th:” to HTML attributes ● Use “th:text” if you replace textnode
  • 5. At a glance (Demo)
  • 6. Basics <span th:text="${name}">bob</span> <input type="text" value="red" th:value="blue"/>
  • 7. Conditional Evaluation <button th:if=”${registered}”>clear</button> <button th:unless=”${registered}”>register</button>
  • 8. Iteration <tr th:each=”user : ${users}”> <td th:text=”${user.name}”>name</td> <td th:text=”${user.age}”>age</td> </tr>
  • 9. JavaScript inlining ● /*[[...]]*/ expression var endpoint = /*[[@{/user/}]]*/ ‘default’; ● JavaBeans to JSON var user = /*[[${user}]]*/ ‘{}’ ↓ var user = {‘name’:’bob’, ‘age’:20};
  • 10. i18n 1. Prepare properties files ○ Messages_en.properties ■ hello=hello ○ Messages_fr.properties ■ hello=bonjour 2. Specify key in #{...} expression e.g.) locale=fr_FR <h1 th:text=”#{hello}”>hello</h1> ↓ <h1>bonjour</h1>
  • 11. fin