SlideShare una empresa de Scribd logo
1 de 51
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

Spring boot
Spring bootSpring boot
Spring bootsdeeg
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.jsEmanuele DelBono
 
Spring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutesSpring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutesVMware Tanzu
 
Let's discover React and Redux with TypeScript
Let's discover React and Redux with TypeScriptLet's discover React and Redux with TypeScript
Let's discover React and Redux with TypeScriptMathieu Savy
 
Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use casesFabio Biondi
 
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...Edureka!
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework Serhat Can
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUDPrem Sanil
 
Lets make a better react form
Lets make a better react formLets make a better react form
Lets make a better react formYao Nien Chung
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6Rob Eisenberg
 

La actualidad más candente (20)

angular fundamentals.pdf
angular fundamentals.pdfangular fundamentals.pdf
angular fundamentals.pdf
 
Web api
Web apiWeb api
Web api
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
 
Spring boot
Spring bootSpring boot
Spring boot
 
Introduction to java 8 stream api
Introduction to java 8 stream apiIntroduction to java 8 stream api
Introduction to java 8 stream api
 
Spring jdbc
Spring jdbcSpring jdbc
Spring jdbc
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
 
Spring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutesSpring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutes
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Let's discover React and Redux with TypeScript
Let's discover React and Redux with TypeScriptLet's discover React and Redux with TypeScript
Let's discover React and Redux with TypeScript
 
Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use cases
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...
Lambda Expressions in Java | Java Lambda Tutorial | Java Certification Traini...
 
Express js
Express jsExpress js
Express js
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
Lets make a better react form
Lets make a better react formLets make a better react form
Lets make a better react form
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
 

Destacado

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
 
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
 

Destacado (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のすすめ
 
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
 
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
 

Similar a 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 a 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
 

Último

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 

Último (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 

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