SlideShare a Scribd company logo
1 of 51
Download to read offline
Who are these guys?
José Miguel Samper
  Thymeleaf active contributor (since the beginning!)
  OSS author: osSeo, porQual, YAV Tags


Daniel Fernández
  Thymeleaf author & project lead
  Also jasypt, op4j, javatuples, javaRuntype, javagalician
AGENDA
1. Introducing Thymeleaf
2. Natural templating
3. Let's write templates!
4. Present + future
Introducing Thymeleaf
1. Introducing Thymeleaf
2. Natural templating
3. Let's write templates!
4. Present + future
The Project
· It's a Java Template Engine
· Can be used as view layer in Spring MVC
· First stable release: July 2011
· Currently: 2.0.x
· Elegant, configurable, extensible
· 21st-century feature set
· FUN TO USE!
A template engine? What's that? (I)
· Not a Web Framework
· Usually a part of them
  · Many web frameworks have their own
  · Takes care of the view layer
  · Template + Data = Document


      ${user.name} → John Apricot
Template engines in Spring MVC (II)
· Abstraction:
  · ViewResolver, View
· Default: JSP + JSTL + Spring taglibs
· Other integrations:
  · Apache Velocity
  · FreeMarker
  · Apache Tiles, XSTL, JasperReports, ...
How does it look like?
The (main) features
· Java, DOM-based
· Online (Web) or Offline (email, XML data...)
· Produces XML, XHTML or HTML5
· Expression eval, i18n, URL rewriting...
· Full Spring MVC integration
  · Spring EL, form binding, i18n...
· Configurable and extensible
· Static prototyping abilities
Some features are special (I)
· DOM-based: Especially made for the web
  · Web UIs are represented as DOM @ browsers
  · DOM allows powerful processing of documents
  · Thymeleaf's DOM means processing power
  · Better than sequential text processing
Some features are special (II)
· Configurability & Extensibility
  · Dialects
          •    From "create your own processor
               libraries"...
          •    ... to "create your own template engine"
  · Resolvers ("finders"): templates, messages...
  · Cache strategies
  · Even "Template Modes"
          •    Decide what you want to call "a template"
          •    If it's DOM-able, it's processable.
Some features are special (III)
· Static prototypes
  · Static prototyping is not your enemy anymore
  · UI usually starts with static prototypes
  · Prototype-to-working-UI usually hard path
  · A new approach: NATURAL TEMPLATING!
Natural Templating
1. Introducing Thymeleaf
2. Natural templating
3. Let's write templates!
4. Present + future
Natural what?
· From Wikipedia: Template Engine (web)


“Natural Templates = the template can be
  a document as valid as the final result,
   the engine syntax doesn't break the
          document's structure”
How do we evaluate it?
· “valid document, don't break structure”
· Templates should be statically displayable
· Static = Open in browser, no web server
· Templates should work as prototypes
How can that be done?
· Take profit of browsers' display behaviour
· Use custom attribs, browsers ignore them

    <div exec="doit()">...</div>

· No expressions inside tag bodies

   <div exec="substitute_body('hello!')">
      Some nice prototyping text...
   </div>
Can JSP do it?
Can JSP do it?




             NO :-(
Can JSP+JSTL do it?
Can JSP+JSTL do it?




            NO :-|
Can Velocity do it?
Can Velocity do it?




            NO :o(
Can FreeMarker do it?
Can FreeMarker do it?




            NO :-[
And... can Thymeleaf do it?
And... can Thymeleaf do it?




           YES! ;-)
Just how bad is not having this? (I)
thvsjsp (example app): JSP on web server
Just how bad is not having this? (II)
thvsjsp: Thymeleaf on web server
Just how bad is not having this? (III)
thvsjsp: JSP statically displayed
Just how bad is not having this? (IV)
thvsjsp: Thymeleaf statically displayed
Let's write templates!
1. Introducing Thymeleaf
2. Natural templating
3. Let's write templates!
4. Present + future
Writing texts
· th:text HTML-escaped text (default)
· th:utext unescaped text
Formatting
#dates, #calendars, #numbers, #strings...
URLs
· @{...} syntax


 ...produces...



· Automatic URL-rewriting is performed
Iteration
· th:each



 ...produces...
Iteration status
· th:each



...produces...
Conditionals (I)
· th:if



· th:unless
Conditionals (II)
· th:switch / th:case
Forms and bean-binding (I)
· th:object, th:field
Forms and bean-binding (II)
· Forms integrate fully with Spring
  · th:field acts exactly as Spring taglib tags
         •   Slightly different behaviour depending on
             host tag
  · PropertyEditors work OK
  · Spring EL expressions in th:field work OK
  · Validations work OK (th:errors)
Page composition
· Declare fragment with th:fragment




· Reuse th:include



· ...and reuse again...
Inlining
· Text, Javascript and Dart inlining
· th:inline="text"|"javascript"|"dart"
Present + Future
1. Introducing Thymeleaf
2. Natural templating
3. Let's write templates!
4. Present + future
Does anybody use this thing?
· OSS = # of users difficult to know
· Jul 2011 - Jan 2012: 2,528 downloads
  · Strongly increasing rate
  · Top country @SF.net: China (37%)
  · With Spring integrations @maven: 89%
Thymeleaf in production
· sahibinden.com
 · Online classifieds & ecommerce, Turkey
 · [alexa.com] rank 625th worldwide, 9th Turkey
 · Search engine frontend
        •   View layer: Thymeleaf 2.0
        •   Size: 20 servers
        •   1 Billion hits/month ~385/sec
 · Helped in boosting Thymeleaf performance
The Future
· Detached template modes
        –   One file for HTML, another for instructions
· More performance fine-tuning
· More docs, tutorials, example apps...
· Maven archetype(s)
· ...
Where to go, what to see...
· Documentation, articles, code examples
   http://www.thymeleaf.org/documentation.html



· User forum
            http://forum.thymeleaf.org/



· Twitter
                    @thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf
Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf

More Related Content

What's hot

JDBC Java Database Connectivity
JDBC Java Database ConnectivityJDBC Java Database Connectivity
JDBC Java Database ConnectivityRanjan Kumar
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework tola99
 
Introduction à spring boot
Introduction à spring bootIntroduction à spring boot
Introduction à spring bootAntoine Rey
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introductionSimon Funk
 
Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use casesFabio Biondi
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel frameworkAhmad Fatoni
 
Docker introduction
Docker introductionDocker introduction
Docker introductionPhuc Nguyen
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentationVan Huong
 
L'API Collector dans tous ses états
L'API Collector dans tous ses étatsL'API Collector dans tous ses états
L'API Collector dans tous ses étatsJosé Paumard
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework Serhat Can
 

What's hot (20)

Why Laravel?
Why Laravel?Why Laravel?
Why Laravel?
 
angular fundamentals.pdf
angular fundamentals.pdfangular fundamentals.pdf
angular fundamentals.pdf
 
JDBC Java Database Connectivity
JDBC Java Database ConnectivityJDBC Java Database Connectivity
JDBC Java Database Connectivity
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial PPT
 
Introduction à spring boot
Introduction à spring bootIntroduction à spring boot
Introduction à spring boot
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introduction
 
Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use cases
 
Laravel Introduction
Laravel IntroductionLaravel Introduction
Laravel Introduction
 
Java8 features
Java8 featuresJava8 features
Java8 features
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel framework
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentation
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
L'API Collector dans tous ses états
L'API Collector dans tous ses étatsL'API Collector dans tous ses états
L'API Collector dans tous ses états
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 

Viewers also liked

Thymeleaf Introduction
Thymeleaf IntroductionThymeleaf Introduction
Thymeleaf IntroductionAnthony Chen
 
Shootout! Template engines for the JVM
Shootout! Template engines for the JVMShootout! Template engines for the JVM
Shootout! Template engines for the JVMJeroen Reijn
 
Introducing thymeleaf
Introducing thymeleafIntroducing thymeleaf
Introducing thymeleafeiryu
 
Thymeleafでハマったこと
ThymeleafでハマったことThymeleafでハマったこと
Thymeleafでハマったことeiryu
 
Thymeleafのすすめ
ThymeleafのすすめThymeleafのすすめ
Thymeleafのすすめeiryu
 
Getting start Java EE Action-Based MVC with Thymeleaf
Getting start Java EE Action-Based MVC with ThymeleafGetting start Java EE Action-Based MVC with Thymeleaf
Getting start Java EE Action-Based MVC with ThymeleafMasatoshi Tada
 
Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...ENSET, Université Hassan II Casablanca
 
App Design + Layout
App Design + LayoutApp Design + Layout
App Design + LayoutPuttiApps
 
Website design configuration
Website design configurationWebsite design configuration
Website design configurationPuttiApps
 
RESTful web services using java and spring
RESTful web services using java and springRESTful web services using java and spring
RESTful web services using java and springMuhammad Junaid Ansari
 
Web-Entwicklung mit Spring, Hibernate und Facelets in Eclipse
Web-Entwicklung mit Spring, Hibernate und Facelets in EclipseWeb-Entwicklung mit Spring, Hibernate und Facelets in Eclipse
Web-Entwicklung mit Spring, Hibernate und Facelets in EclipseSarah Steffen
 
Summer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and ScalaSummer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and Scalarostislav
 
Shootout! template engines on the jvm
Shootout! template engines on the jvmShootout! template engines on the jvm
Shootout! template engines on the jvmNLJUG
 
Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Naresh Chintalcheru
 
打造完全免費的,JAVA專案持續整合環境_ 2013 java developer_day_by 李書豪
打造完全免費的,JAVA專案持續整合環境_ 2013 java developer_day_by 李書豪打造完全免費的,JAVA專案持續整合環境_ 2013 java developer_day_by 李書豪
打造完全免費的,JAVA專案持續整合環境_ 2013 java developer_day_by 李書豪奕孝 陳
 
Spring Security
Spring SecuritySpring Security
Spring SecurityBoy Tech
 
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
 

Viewers also liked (20)

Thymeleaf Introduction
Thymeleaf IntroductionThymeleaf Introduction
Thymeleaf Introduction
 
Introduction to thymeleaf
Introduction to thymeleafIntroduction to thymeleaf
Introduction to thymeleaf
 
Shootout! Template engines for the JVM
Shootout! Template engines for the JVMShootout! Template engines for the JVM
Shootout! Template engines for the JVM
 
Thymeleaf, will it blend?
Thymeleaf, will it blend?Thymeleaf, will it blend?
Thymeleaf, will it blend?
 
Introducing thymeleaf
Introducing thymeleafIntroducing thymeleaf
Introducing thymeleaf
 
Thymeleafでハマったこと
ThymeleafでハマったことThymeleafでハマったこと
Thymeleafでハマったこと
 
Thymeleafのすすめ
ThymeleafのすすめThymeleafのすすめ
Thymeleafのすすめ
 
Broadleaf Presents Thymeleaf
Broadleaf Presents ThymeleafBroadleaf Presents Thymeleaf
Broadleaf Presents Thymeleaf
 
Getting start Java EE Action-Based MVC with Thymeleaf
Getting start Java EE Action-Based MVC with ThymeleafGetting start Java EE Action-Based MVC with Thymeleaf
Getting start Java EE Action-Based MVC with Thymeleaf
 
Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...
 
App Design + Layout
App Design + LayoutApp Design + Layout
App Design + Layout
 
Website design configuration
Website design configurationWebsite design configuration
Website design configuration
 
RESTful web services using java and spring
RESTful web services using java and springRESTful web services using java and spring
RESTful web services using java and spring
 
Web-Entwicklung mit Spring, Hibernate und Facelets in Eclipse
Web-Entwicklung mit Spring, Hibernate und Facelets in EclipseWeb-Entwicklung mit Spring, Hibernate und Facelets in Eclipse
Web-Entwicklung mit Spring, Hibernate und Facelets in Eclipse
 
Summer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and ScalaSummer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and Scala
 
Shootout! template engines on the jvm
Shootout! template engines on the jvmShootout! template engines on the jvm
Shootout! template engines on the jvm
 
Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC
 
打造完全免費的,JAVA專案持續整合環境_ 2013 java developer_day_by 李書豪
打造完全免費的,JAVA專案持續整合環境_ 2013 java developer_day_by 李書豪打造完全免費的,JAVA專案持續整合環境_ 2013 java developer_day_by 李書豪
打造完全免費的,JAVA專案持續整合環境_ 2013 java developer_day_by 李書豪
 
Spring Security
Spring SecuritySpring Security
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
 

Similar to Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf

Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016Marco Breveglieri
 
TypeScript-SPS-melb.pptx
TypeScript-SPS-melb.pptxTypeScript-SPS-melb.pptx
TypeScript-SPS-melb.pptxaccordv12
 
Using Apache Camel as AKKA
Using Apache Camel as AKKAUsing Apache Camel as AKKA
Using Apache Camel as AKKAJohan Edstrom
 
Intro javascript build a scraper (3:22)
Intro javascript   build a scraper (3:22)Intro javascript   build a scraper (3:22)
Intro javascript build a scraper (3:22)Thinkful
 
Agile Software Development by Sencha
Agile Software Development by SenchaAgile Software Development by Sencha
Agile Software Development by SenchaLael Rukius
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptAxway Appcelerator
 
The JavaScript Delusion
The JavaScript DelusionThe JavaScript Delusion
The JavaScript DelusionJUGBD
 
Functional solid
Functional solidFunctional solid
Functional solidMatt Stine
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.jsKasey McCurdy
 
Modern Java web applications with Spring Boot and Thymeleaf
Modern Java web applications with Spring Boot and ThymeleafModern Java web applications with Spring Boot and Thymeleaf
Modern Java web applications with Spring Boot and ThymeleafLAY Leangsros
 
Features, Exportables & You
Features, Exportables & YouFeatures, Exportables & You
Features, Exportables & Youjskulski
 
The Ideas of Clojure - Things I learn from Clojure
The Ideas of Clojure - Things I learn from ClojureThe Ideas of Clojure - Things I learn from Clojure
The Ideas of Clojure - Things I learn from ClojureHsuan Fu Lien
 
Dapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDavide Mauri
 
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...7mind
 
This is presentation at Mitaka.rb #10.
This is presentation at Mitaka.rb #10.This is presentation at Mitaka.rb #10.
This is presentation at Mitaka.rb #10.Masaki Komagata
 
Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updatesVinay H G
 

Similar to Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf (20)

Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016
 
TypeScript-SPS-melb.pptx
TypeScript-SPS-melb.pptxTypeScript-SPS-melb.pptx
TypeScript-SPS-melb.pptx
 
Using Apache Camel as AKKA
Using Apache Camel as AKKAUsing Apache Camel as AKKA
Using Apache Camel as AKKA
 
Surge2012
Surge2012Surge2012
Surge2012
 
Intro javascript build a scraper (3:22)
Intro javascript   build a scraper (3:22)Intro javascript   build a scraper (3:22)
Intro javascript build a scraper (3:22)
 
Agile Software Development by Sencha
Agile Software Development by SenchaAgile Software Development by Sencha
Agile Software Development by Sencha
 
Dust.js
Dust.jsDust.js
Dust.js
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScript
 
The JavaScript Delusion
The JavaScript DelusionThe JavaScript Delusion
The JavaScript Delusion
 
Wt unit 4
Wt unit 4Wt unit 4
Wt unit 4
 
Functional solid
Functional solidFunctional solid
Functional solid
 
Titanium Alloy Tutorial
Titanium Alloy TutorialTitanium Alloy Tutorial
Titanium Alloy Tutorial
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
Modern Java web applications with Spring Boot and Thymeleaf
Modern Java web applications with Spring Boot and ThymeleafModern Java web applications with Spring Boot and Thymeleaf
Modern Java web applications with Spring Boot and Thymeleaf
 
Features, Exportables & You
Features, Exportables & YouFeatures, Exportables & You
Features, Exportables & You
 
The Ideas of Clojure - Things I learn from Clojure
The Ideas of Clojure - Things I learn from ClojureThe Ideas of Clojure - Things I learn from Clojure
The Ideas of Clojure - Things I learn from Clojure
 
Dapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDapper: the microORM that will change your life
Dapper: the microORM that will change your life
 
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
 
This is presentation at Mitaka.rb #10.
This is presentation at Mitaka.rb #10.This is presentation at Mitaka.rb #10.
This is presentation at Mitaka.rb #10.
 
Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updates
 

Recently uploaded

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 

Recently uploaded (20)

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 

Spring I/O 2012: Natural Templating in Spring MVC with Thymeleaf

  • 1.
  • 2. Who are these guys? José Miguel Samper Thymeleaf active contributor (since the beginning!) OSS author: osSeo, porQual, YAV Tags Daniel Fernández Thymeleaf author & project lead Also jasypt, op4j, javatuples, javaRuntype, javagalician
  • 3. AGENDA 1. Introducing Thymeleaf 2. Natural templating 3. Let's write templates! 4. Present + future
  • 4. Introducing Thymeleaf 1. Introducing Thymeleaf 2. Natural templating 3. Let's write templates! 4. Present + future
  • 5. The Project · It's a Java Template Engine · Can be used as view layer in Spring MVC · First stable release: July 2011 · Currently: 2.0.x · Elegant, configurable, extensible · 21st-century feature set · FUN TO USE!
  • 6. A template engine? What's that? (I) · Not a Web Framework · Usually a part of them · Many web frameworks have their own · Takes care of the view layer · Template + Data = Document ${user.name} → John Apricot
  • 7.
  • 8. Template engines in Spring MVC (II) · Abstraction: · ViewResolver, View · Default: JSP + JSTL + Spring taglibs · Other integrations: · Apache Velocity · FreeMarker · Apache Tiles, XSTL, JasperReports, ...
  • 9. How does it look like?
  • 10. The (main) features · Java, DOM-based · Online (Web) or Offline (email, XML data...) · Produces XML, XHTML or HTML5 · Expression eval, i18n, URL rewriting... · Full Spring MVC integration · Spring EL, form binding, i18n... · Configurable and extensible · Static prototyping abilities
  • 11. Some features are special (I) · DOM-based: Especially made for the web · Web UIs are represented as DOM @ browsers · DOM allows powerful processing of documents · Thymeleaf's DOM means processing power · Better than sequential text processing
  • 12. Some features are special (II) · Configurability & Extensibility · Dialects • From "create your own processor libraries"... • ... to "create your own template engine" · Resolvers ("finders"): templates, messages... · Cache strategies · Even "Template Modes" • Decide what you want to call "a template" • If it's DOM-able, it's processable.
  • 13. Some features are special (III) · Static prototypes · Static prototyping is not your enemy anymore · UI usually starts with static prototypes · Prototype-to-working-UI usually hard path · A new approach: NATURAL TEMPLATING!
  • 14. Natural Templating 1. Introducing Thymeleaf 2. Natural templating 3. Let's write templates! 4. Present + future
  • 15. Natural what? · From Wikipedia: Template Engine (web) “Natural Templates = the template can be a document as valid as the final result, the engine syntax doesn't break the document's structure”
  • 16. How do we evaluate it? · “valid document, don't break structure” · Templates should be statically displayable · Static = Open in browser, no web server · Templates should work as prototypes
  • 17. How can that be done? · Take profit of browsers' display behaviour · Use custom attribs, browsers ignore them <div exec="doit()">...</div> · No expressions inside tag bodies <div exec="substitute_body('hello!')"> Some nice prototyping text... </div>
  • 18. Can JSP do it?
  • 19. Can JSP do it? NO :-(
  • 21. Can JSP+JSTL do it? NO :-|
  • 23. Can Velocity do it? NO :o(
  • 25. Can FreeMarker do it? NO :-[
  • 27. And... can Thymeleaf do it? YES! ;-)
  • 28. Just how bad is not having this? (I) thvsjsp (example app): JSP on web server
  • 29. Just how bad is not having this? (II) thvsjsp: Thymeleaf on web server
  • 30. Just how bad is not having this? (III) thvsjsp: JSP statically displayed
  • 31. Just how bad is not having this? (IV) thvsjsp: Thymeleaf statically displayed
  • 32. Let's write templates! 1. Introducing Thymeleaf 2. Natural templating 3. Let's write templates! 4. Present + future
  • 33. Writing texts · th:text HTML-escaped text (default) · th:utext unescaped text
  • 35. URLs · @{...} syntax ...produces... · Automatic URL-rewriting is performed
  • 40. Forms and bean-binding (I) · th:object, th:field
  • 41. Forms and bean-binding (II) · Forms integrate fully with Spring · th:field acts exactly as Spring taglib tags • Slightly different behaviour depending on host tag · PropertyEditors work OK · Spring EL expressions in th:field work OK · Validations work OK (th:errors)
  • 42. Page composition · Declare fragment with th:fragment · Reuse th:include · ...and reuse again...
  • 43. Inlining · Text, Javascript and Dart inlining · th:inline="text"|"javascript"|"dart"
  • 44. Present + Future 1. Introducing Thymeleaf 2. Natural templating 3. Let's write templates! 4. Present + future
  • 45. Does anybody use this thing? · OSS = # of users difficult to know · Jul 2011 - Jan 2012: 2,528 downloads · Strongly increasing rate · Top country @SF.net: China (37%) · With Spring integrations @maven: 89%
  • 46. Thymeleaf in production · sahibinden.com · Online classifieds & ecommerce, Turkey · [alexa.com] rank 625th worldwide, 9th Turkey · Search engine frontend • View layer: Thymeleaf 2.0 • Size: 20 servers • 1 Billion hits/month ~385/sec · Helped in boosting Thymeleaf performance
  • 47. The Future · Detached template modes – One file for HTML, another for instructions · More performance fine-tuning · More docs, tutorials, example apps... · Maven archetype(s) · ...
  • 48. Where to go, what to see... · Documentation, articles, code examples http://www.thymeleaf.org/documentation.html · User forum http://forum.thymeleaf.org/ · Twitter @thymeleaf