SlideShare a Scribd company logo
1 of 37
Download to read offline
Enhancing Spring MVC
Web Applications with
Spring JavaScript
Jeremy Grelle - SpringSource
Slide Title




   In this session, you will learn how Spring JavaScript
   makes it simple to integrate rich Ajax toolkits such
   as Dojo into a Spring Web application to create
   compelling user interfaces.




                SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Introduction

• Who am I???
  – Jeremy Grelle
     • Senior Software Engineer, SpringSource
     • Member of Spring Web Products team in San
       Francisco, CA
     • Lead of Spring Faces, Spring JavaScript, Spring
       BlazeDS Integration
     • JSF 2.0 EG member.
     • SpringSource's resident Ajax ninja.
     • Rock Star / Geek




                                                                                                 3
                SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Topics in this session

•   Overview of Ajax
•   Introduction to Spring JS
•   Spring JS Building Blocks
•   Spring JS Advanced Solutions
•   Spring JS + RESTful MVC




                                                                                                 4
                SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
What is Ajax?

• An ever-evolving definition

• Philosophy of User Experience

• Search for the right balance between client and
  server

• AJAX != Ajax




                                                                                                5
               SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
The Building Blocks of Ajax

• Document Object Model (DOM)
  – tree HTML representation
  – easy to target parts of dynamic web page
  – e.g. 'disable all fields within a div'
• Cascading Stylesheets (CSS)
  – separates content (HTML) from style
  – CSS selectors apply style across DOM elements
• XMLHttpRequest
  – JavaScript API for asynchronous requests
• JavaScript Object Notation (JSON)



                                                                                               6
              SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Different Ajax Approaches

• JavaScript toolkit
  – Dojo, YUI, jQuery
• JavaScript wrapped
  – in JSF components (ICEfaces, RichFaces)
  – in JSP custom tags (AjaxTags)
• JavaScript generated
  – GWT
• JavaScript RPC-style invocations
  – DWR, JSON-RPC
• RIA - Not necessarily based on JavaScript



                                                                                               7
              SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Different Kinds of Frameworks

• Lightweight libraries
  – jQuery, Prototype, Scriptaculous

• Full solution frameworks
  – Dojo, YUI, Ext, GWT




                                                                                                8
               SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Different Application Types

• Applications based on browsing model
    – document-like, bookmarks, back button, refresh
    – example: infoq.com

 • Very rich applications in a browser
    – desktop style, window panes, menus
    – example: Google Maps, Bespin

 • Many applications somewhere in between
    – finding the right balance is important




                                                                                                  9
                 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
The User Experience

• Ajax can do pretty “cool” things
  – it's easy to be awed at first BUT...
  – harder to predict the overall experience
• Consider the following “disruptive” effects
  – back/forward button
  – bookmarking
  – JavaScript turned off
  – support for accessibility features
• It's necessary to be pragmatic in using Ajax
  techniques
  – find the right blend of document-based vs. rich client



                                                                                                  10
                 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Ajax and Server-Side
Frameworks
• Ajax agnostic to server-side framework
    – plain HTTP request

 • The response is the contract
    – HTML (partial DOM update), JSON, XML, ...

 • Full HTML still required even for RIA
    – login page, help pages, ...




                                                                                                  11
                 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Spring MVC with Ajax

 • A swiss army knife for Web developers
  – very flexible, pluggable

 • Well-suited to handle Ajax requests
  – supports many rendering technologies
  – easy to expose HTTP endpoints
  – RESTful architecture is an ideal Ajax back-end

 • Versatility truly matters here!




                                                                                                12
               SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Topics in this session

•   Overview of Ajax
•   Introduction to Spring JS
•   Spring JS Building Blocks
•   Spring JS Advanced Solutions
•   Spring JS + RESTful MVC




                                                                                                 13
                SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Spring JavaScript Overview

• JavaScript abstraction framework
    – builds on existing toolkits
    – introduced as a SWF 2 module, moving to top-level
      project for 2010

 • Public API with implementations
    – currently Dojo
    – others possible (jQuery next)

 • A pragmatic approach
    – baked-in performance (Yahoo guidelines)
    – progressive enhancement

                                                                                                  14
                 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Progressive Enhancement
(client side)

• Add Ajax behavior unobtrusively
  – avoid proliferation of JavaScript

• Manipulate DOM nodes
  – “enhance” plain HTML elements

• Page functions with or without JavaScript




                                                                                                15
               SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Progressive Enhancement
(server side)

• Avoid separate controllers for Ajax
  – use same request handling methods

• Render a page partially
  – composition-based template approach

• Alternate response types
  – HTML, JSON, XML, ...




                                                                                               16
              SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
The Parts of Spring JS

• JavaScript libraries
  – public API + implementations
• Bundled (optimized) toolkits
  – currently Dojo 1.2
• “Starter” CSS framework
  – Mike Stenhouse's CSS framework
• ResourceServlet
  – efficient rendering of static resources in a war or
  a jar
• Spring MVC infrastructure for Ajax
  – AjaxUrlBasedViewResolver, AjaxTilesView, ...

                                                                                                17
               SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
The ResourceServlet

• Generic servlet to serve static resources
  – .js, .css, .jpeg, .gif, etc.

• Locates resources given the path info
  – first under the Web application root
  – the classpath as a fall back

• Writes the resource to the HTTP response
  – gzip compression
  – set response headers: last modified, content
  type, ...


                                                                                                18
               SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Serving Spring JS Files

 • Spring JS distributed as a jar
      – bundles JavaScript, CSS, and other resources
 • Serve them with the ResourceServlet
 • Possible to override bundled resources
      – include your own in the webapp root
<servlet>
 <servlet-name>Resources Servlet</servlet-name>
 <servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
 <servlet-name>Resources Servlet</servlet-name>
 <url-pattern>/resources/*</url-pattern>
</servlet-mapping>

                                                                                                         19
                        SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Spring JS Resources

• Underlying library
  – /resources/dojo/dojo.js

• Public API
  – /resources/spring/Spring.js

• Toolkit-specific implementation
  – /resources/spring/Spring-Dojo.js

• Additional underlying library resources
  – /resources/dijit/themes/tundra/tundra.css


                                                                                                20
               SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Including Spring JS On a Page

 • Include required files
<link type="text/css" rel="stylesheet"
   href="<c:url value="/resources/dijit/themes/tundra/tundra.css" />" />

<script type="text/javascript"
          src ="<c:url value="/resources/dojo/dojo.js" />"><script/>
<script type="text/javascript"
          src ="<c:url value="/resources/spring/Spring.js" />"><script/>
<script type="text/javascript"
          src ="<c:url value="/resources/spring/Spring-Dojo.js" />"><script/>

 • Add Dojo “tundra” style to body tag
<body class="tundra" > ...



                                                                                                          21
                         SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Topics in this session

•   Overview of Ajax
•   Introduction to Spring JS
•   Spring JS Building Blocks
•   Spring JS Advanced Solutions
•   Spring JS + RESTful MVC




                                                                                                 22
                SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Enhancing a DOM Node

• DOM nodes can be manipulated
  – decorate with new look and/or behavior
  – via JS and CSS

• A common technique for “enhancing” plain HTML
  – separates static from dynamic parts
  – easier to understand & maintain

• Supported by underlying toolkit
  – e.g. turn HTML form fields to rich widgets



                                                                                                23
               SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Spring JS Decorations

• Mechanism for DOM node enhancements
  – abstracts underlying toolkit

• A function for applying decorations
  – Spring.addDecoration(/*Object*/decoration)

• Several available decorations
  – Element decoration
  – Ajax event decoration
  – Validate All decoration



                                                                                                24
               SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Fragment Rendering

• An Ajax call refreshes parts of a page
  – response must contain a “fragment”
  – not HTML for entire page

• Yet controllers should not be aware of Ajax
  – easier to maintain that way

• Spring JS provides special Spring MVC view
  – renders a fragment of the response only
  – works transparently



                                                                                                25
               SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
The “Fragments” Parameter

• Ajax event decoration submits special parameter
  – a hint for what HTML to be rendered

• Server notices special parameter
  – renders only specified fragment

• Composition-based view technology is required
  – currently JSP/Tiles supported only
  – fragment names match to a Tiles attribute




                                                                                                26
               SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Built-In Response Handling
Types
• Refresh portions of the page
   – grab top-level DOM nodes
   – replace equivalent nodes on existing page

• Present Ajax popup
   – a modal dialog with the returned HTML
   – enable via AjaxEventDecoration “popup” attribute

• Client side redirect
   – detects server response requesting client-side
     redirect
   – requires AjaxUrlBasedViewResolver


                                                                                                 27
                SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Demo
Spring JS Building Blocks




       SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Topics in this session

•   Overview of Ajax
•   Introduction to Spring JS
•   Spring JS Building Blocks
•   Spring JS Advanced Solutions
•   Spring JS + RESTful MVC




                                                                                                29
               SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Common Questions

• The fundamental pieces of Spring JS seem nice,
  but how do I...

  – perform custom response handling?

  – make my code more terse?

  – keep things DRY?

  – organize and modularize my growing amount of
    JavaScript code?


                                                                                               30
              SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Demo
Spring JS Advanced Solutions




       SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Topics in this session

•   Overview of Ajax
•   Introduction to Spring JS
•   Spring JS Building Blocks
•   Spring JS Advanced Solutions
•   Spring JS + RESTful MVC




                                                                                                 32
                SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
The Evolving Web Platform

• Capable browsers with advanced JavaScript VM’s
  are becoming more commonplace
  – Safari, Firefox, and Chrome
  – Webkit-based mobile browsers

• As the platform evolves, boundaries can be pushed
  further on the client
  – see Canvas, SVG, Video in HTML 5

• RESTful services provide the perfect compliment
  on the server-side
  – JSON representations easy to consume

                                                                                               33
              SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
JSON support in Spring 3.0

• MappingJacksonJsonView
  – renders the model as JSON
  – customizable via annotations
  – high-performance

• MappingJacksonHttpMessageConverter
  – easy binding from a JSON payload




                                                                                               34
              SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Demo
Consuming RESTful Services




      SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Summary

• Spring MVC very useful for Ajax
  – a swiss-army knife

• Spring JS provides simple abstraction
  – builds on existing Ajax toolkits
  – provides both client and server side components

• Many common enterprise scenarios made easy
  – rich forms
  – partial page updates
  – Ajax popups
  – JSON

                                                                                                   36
                  SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
Q&A




      SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.

More Related Content

What's hot

新版阿尔法城背后的前端MVC实践
新版阿尔法城背后的前端MVC实践新版阿尔法城背后的前端MVC实践
新版阿尔法城背后的前端MVC实践Dexter Yang
 
Intro to Java ME and Asha Platform
Intro to Java ME and Asha PlatformIntro to Java ME and Asha Platform
Intro to Java ME and Asha PlatformJussi Pohjolainen
 
Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Adam Mokan
 
The Modern Java Web Developer - JavaOne 2013
The Modern Java Web Developer - JavaOne 2013The Modern Java Web Developer - JavaOne 2013
The Modern Java Web Developer - JavaOne 2013Matt Raible
 
Intro to drupal
Intro to drupalIntro to drupal
Intro to drupalhernanibf
 
2013 04-02-server-side-backbone
2013 04-02-server-side-backbone2013 04-02-server-side-backbone
2013 04-02-server-side-backboneSC5.io
 
Oxford DrupalCamp 2012 - The things we found in your website
Oxford DrupalCamp 2012 - The things we found in your websiteOxford DrupalCamp 2012 - The things we found in your website
Oxford DrupalCamp 2012 - The things we found in your websitehernanibf
 
One Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp LondonOne Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp Londonhernanibf
 
Comparing JVM Web Frameworks - Devoxx 2010
Comparing JVM Web Frameworks - Devoxx 2010Comparing JVM Web Frameworks - Devoxx 2010
Comparing JVM Web Frameworks - Devoxx 2010Matt Raible
 
Front End page speed performance improvements for Drupal
Front End page speed performance improvements for DrupalFront End page speed performance improvements for Drupal
Front End page speed performance improvements for DrupalAndy Kucharski
 
JavaONE 2012 Using Java with HTML5 and CSS3
JavaONE 2012 Using Java with HTML5 and CSS3JavaONE 2012 Using Java with HTML5 and CSS3
JavaONE 2012 Using Java with HTML5 and CSS3Helder da Rocha
 
My site is slow
My site is slowMy site is slow
My site is slowhernanibf
 
Drupal - Introduction to Building Library Web Site Using Drupal
Drupal - Introduction to Building Library Web Site Using DrupalDrupal - Introduction to Building Library Web Site Using Drupal
Drupal - Introduction to Building Library Web Site Using DrupalVibrant Technologies & Computers
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPagesTeamstudio
 
Devfest09 Cschalk Gwt
Devfest09 Cschalk GwtDevfest09 Cschalk Gwt
Devfest09 Cschalk GwtChris Schalk
 
Building and Managing Projects with Maven
Building and Managing Projects with MavenBuilding and Managing Projects with Maven
Building and Managing Projects with MavenKhan625
 

What's hot (19)

新版阿尔法城背后的前端MVC实践
新版阿尔法城背后的前端MVC实践新版阿尔法城背后的前端MVC实践
新版阿尔法城背后的前端MVC实践
 
Santosh_Resume_Java
Santosh_Resume_JavaSantosh_Resume_Java
Santosh_Resume_Java
 
Intro to Java ME and Asha Platform
Intro to Java ME and Asha PlatformIntro to Java ME and Asha Platform
Intro to Java ME and Asha Platform
 
Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012
 
The Modern Java Web Developer - JavaOne 2013
The Modern Java Web Developer - JavaOne 2013The Modern Java Web Developer - JavaOne 2013
The Modern Java Web Developer - JavaOne 2013
 
Intro to drupal
Intro to drupalIntro to drupal
Intro to drupal
 
Building SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.jsBuilding SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.js
 
2013 04-02-server-side-backbone
2013 04-02-server-side-backbone2013 04-02-server-side-backbone
2013 04-02-server-side-backbone
 
Oxford DrupalCamp 2012 - The things we found in your website
Oxford DrupalCamp 2012 - The things we found in your websiteOxford DrupalCamp 2012 - The things we found in your website
Oxford DrupalCamp 2012 - The things we found in your website
 
One Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp LondonOne Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp London
 
Comparing JVM Web Frameworks - Devoxx 2010
Comparing JVM Web Frameworks - Devoxx 2010Comparing JVM Web Frameworks - Devoxx 2010
Comparing JVM Web Frameworks - Devoxx 2010
 
Next generation Graphics: SVG
Next generation Graphics: SVGNext generation Graphics: SVG
Next generation Graphics: SVG
 
Front End page speed performance improvements for Drupal
Front End page speed performance improvements for DrupalFront End page speed performance improvements for Drupal
Front End page speed performance improvements for Drupal
 
JavaONE 2012 Using Java with HTML5 and CSS3
JavaONE 2012 Using Java with HTML5 and CSS3JavaONE 2012 Using Java with HTML5 and CSS3
JavaONE 2012 Using Java with HTML5 and CSS3
 
My site is slow
My site is slowMy site is slow
My site is slow
 
Drupal - Introduction to Building Library Web Site Using Drupal
Drupal - Introduction to Building Library Web Site Using DrupalDrupal - Introduction to Building Library Web Site Using Drupal
Drupal - Introduction to Building Library Web Site Using Drupal
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPages
 
Devfest09 Cschalk Gwt
Devfest09 Cschalk GwtDevfest09 Cschalk Gwt
Devfest09 Cschalk Gwt
 
Building and Managing Projects with Maven
Building and Managing Projects with MavenBuilding and Managing Projects with Maven
Building and Managing Projects with Maven
 

Viewers also liked

Modern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptmartinlippert
 
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 Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
 
Building a Scalable Architecture for web apps
Building a Scalable Architecture for web appsBuilding a Scalable Architecture for web apps
Building a Scalable Architecture for web appsDirecti Group
 
Hr coverage directi 2012
Hr coverage directi 2012Hr coverage directi 2012
Hr coverage directi 2012Directi Group
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development FundamentalsMohammed Makhlouf
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web ArchitectureChamnap Chhorn
 
Fundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-DevelopersFundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-DevelopersLemi Orhan Ergin
 
Architecture of a Modern Web App
Architecture of a Modern Web AppArchitecture of a Modern Web App
Architecture of a Modern Web Appscothis
 

Viewers also liked (10)

Modern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScript
 
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 Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
 
Building a Scalable Architecture for web apps
Building a Scalable Architecture for web appsBuilding a Scalable Architecture for web apps
Building a Scalable Architecture for web apps
 
Hr coverage directi 2012
Hr coverage directi 2012Hr coverage directi 2012
Hr coverage directi 2012
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development Fundamentals
 
Web application architecture
Web application architectureWeb application architecture
Web application architecture
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web Architecture
 
Fundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-DevelopersFundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-Developers
 
Architecture of a Modern Web App
Architecture of a Modern Web AppArchitecture of a Modern Web App
Architecture of a Modern Web App
 

Similar to Enhancing Spring MVC Web Applications Progressively with Spring JavaScript

Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web ApplicationYakov Fain
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.jsKasey McCurdy
 
Structured web apps
Structured web appsStructured web apps
Structured web appsSheng Tian
 
Building assets on the fly with Node.js
Building assets on the fly with Node.jsBuilding assets on the fly with Node.js
Building assets on the fly with Node.jsAcquisio
 
Going offline with JS (DDD Sydney)
Going offline with JS (DDD Sydney)Going offline with JS (DDD Sydney)
Going offline with JS (DDD Sydney)brendankowitz
 
AJAX Frameworks
AJAX FrameworksAJAX Frameworks
AJAX Frameworksshank
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleIT Arena
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project Elad Hirsch
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and ReactMike Melusky
 
An evening with React Native
An evening with React NativeAn evening with React Native
An evening with React NativeMike Melusky
 
WebNetConf 2012 - Single Page Apps
WebNetConf 2012 - Single Page AppsWebNetConf 2012 - Single Page Apps
WebNetConf 2012 - Single Page AppsPop Apps
 
Server Side Javascript
Server Side JavascriptServer Side Javascript
Server Side Javascriptrajivmordani
 
Kann JavaScript elegant sein?
Kann JavaScript elegant sein?Kann JavaScript elegant sein?
Kann JavaScript elegant sein?jbandi
 
Going Offline with JS
Going Offline with JSGoing Offline with JS
Going Offline with JSbrendankowitz
 
Mobile and IBM Worklight Best Practices
Mobile and IBM Worklight Best PracticesMobile and IBM Worklight Best Practices
Mobile and IBM Worklight Best PracticesAndrew Ferrier
 
01/2009 - Portral development with liferay
01/2009 - Portral development with liferay01/2009 - Portral development with liferay
01/2009 - Portral development with liferaydaveayan
 

Similar to Enhancing Spring MVC Web Applications Progressively with Spring JavaScript (20)

Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
JavaScript-Core
JavaScript-CoreJavaScript-Core
JavaScript-Core
 
Structured web apps
Structured web appsStructured web apps
Structured web apps
 
Building assets on the fly with Node.js
Building assets on the fly with Node.jsBuilding assets on the fly with Node.js
Building assets on the fly with Node.js
 
The Java alternative to Javascript
The Java alternative to JavascriptThe Java alternative to Javascript
The Java alternative to Javascript
 
Going offline with JS (DDD Sydney)
Going offline with JS (DDD Sydney)Going offline with JS (DDD Sydney)
Going offline with JS (DDD Sydney)
 
AJAX Frameworks
AJAX FrameworksAJAX Frameworks
AJAX Frameworks
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and React
 
An evening with React Native
An evening with React NativeAn evening with React Native
An evening with React Native
 
WebNetConf 2012 - Single Page Apps
WebNetConf 2012 - Single Page AppsWebNetConf 2012 - Single Page Apps
WebNetConf 2012 - Single Page Apps
 
Server Side Javascript
Server Side JavascriptServer Side Javascript
Server Side Javascript
 
Kann JavaScript elegant sein?
Kann JavaScript elegant sein?Kann JavaScript elegant sein?
Kann JavaScript elegant sein?
 
Going Offline with JS
Going Offline with JSGoing Offline with JS
Going Offline with JS
 
Mobile and IBM Worklight Best Practices
Mobile and IBM Worklight Best PracticesMobile and IBM Worklight Best Practices
Mobile and IBM Worklight Best Practices
 
01/2009 - Portral development with liferay
01/2009 - Portral development with liferay01/2009 - Portral development with liferay
01/2009 - Portral development with liferay
 
Javascript & Jquery
Javascript & JqueryJavascript & Jquery
Javascript & Jquery
 
GWT-Basics
GWT-BasicsGWT-Basics
GWT-Basics
 

Recently uploaded

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
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
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

Enhancing Spring MVC Web Applications Progressively with Spring JavaScript

  • 1. Enhancing Spring MVC Web Applications with Spring JavaScript Jeremy Grelle - SpringSource
  • 2. Slide Title In this session, you will learn how Spring JavaScript makes it simple to integrate rich Ajax toolkits such as Dojo into a Spring Web application to create compelling user interfaces. SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 3. Introduction • Who am I??? – Jeremy Grelle • Senior Software Engineer, SpringSource • Member of Spring Web Products team in San Francisco, CA • Lead of Spring Faces, Spring JavaScript, Spring BlazeDS Integration • JSF 2.0 EG member. • SpringSource's resident Ajax ninja. • Rock Star / Geek 3 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 4. Topics in this session • Overview of Ajax • Introduction to Spring JS • Spring JS Building Blocks • Spring JS Advanced Solutions • Spring JS + RESTful MVC 4 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 5. What is Ajax? • An ever-evolving definition • Philosophy of User Experience • Search for the right balance between client and server • AJAX != Ajax 5 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 6. The Building Blocks of Ajax • Document Object Model (DOM) – tree HTML representation – easy to target parts of dynamic web page – e.g. 'disable all fields within a div' • Cascading Stylesheets (CSS) – separates content (HTML) from style – CSS selectors apply style across DOM elements • XMLHttpRequest – JavaScript API for asynchronous requests • JavaScript Object Notation (JSON) 6 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 7. Different Ajax Approaches • JavaScript toolkit – Dojo, YUI, jQuery • JavaScript wrapped – in JSF components (ICEfaces, RichFaces) – in JSP custom tags (AjaxTags) • JavaScript generated – GWT • JavaScript RPC-style invocations – DWR, JSON-RPC • RIA - Not necessarily based on JavaScript 7 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 8. Different Kinds of Frameworks • Lightweight libraries – jQuery, Prototype, Scriptaculous • Full solution frameworks – Dojo, YUI, Ext, GWT 8 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 9. Different Application Types • Applications based on browsing model – document-like, bookmarks, back button, refresh – example: infoq.com • Very rich applications in a browser – desktop style, window panes, menus – example: Google Maps, Bespin • Many applications somewhere in between – finding the right balance is important 9 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 10. The User Experience • Ajax can do pretty “cool” things – it's easy to be awed at first BUT... – harder to predict the overall experience • Consider the following “disruptive” effects – back/forward button – bookmarking – JavaScript turned off – support for accessibility features • It's necessary to be pragmatic in using Ajax techniques – find the right blend of document-based vs. rich client 10 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 11. Ajax and Server-Side Frameworks • Ajax agnostic to server-side framework – plain HTTP request • The response is the contract – HTML (partial DOM update), JSON, XML, ... • Full HTML still required even for RIA – login page, help pages, ... 11 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 12. Spring MVC with Ajax • A swiss army knife for Web developers – very flexible, pluggable • Well-suited to handle Ajax requests – supports many rendering technologies – easy to expose HTTP endpoints – RESTful architecture is an ideal Ajax back-end • Versatility truly matters here! 12 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 13. Topics in this session • Overview of Ajax • Introduction to Spring JS • Spring JS Building Blocks • Spring JS Advanced Solutions • Spring JS + RESTful MVC 13 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 14. Spring JavaScript Overview • JavaScript abstraction framework – builds on existing toolkits – introduced as a SWF 2 module, moving to top-level project for 2010 • Public API with implementations – currently Dojo – others possible (jQuery next) • A pragmatic approach – baked-in performance (Yahoo guidelines) – progressive enhancement 14 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 15. Progressive Enhancement (client side) • Add Ajax behavior unobtrusively – avoid proliferation of JavaScript • Manipulate DOM nodes – “enhance” plain HTML elements • Page functions with or without JavaScript 15 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 16. Progressive Enhancement (server side) • Avoid separate controllers for Ajax – use same request handling methods • Render a page partially – composition-based template approach • Alternate response types – HTML, JSON, XML, ... 16 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 17. The Parts of Spring JS • JavaScript libraries – public API + implementations • Bundled (optimized) toolkits – currently Dojo 1.2 • “Starter” CSS framework – Mike Stenhouse's CSS framework • ResourceServlet – efficient rendering of static resources in a war or a jar • Spring MVC infrastructure for Ajax – AjaxUrlBasedViewResolver, AjaxTilesView, ... 17 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 18. The ResourceServlet • Generic servlet to serve static resources – .js, .css, .jpeg, .gif, etc. • Locates resources given the path info – first under the Web application root – the classpath as a fall back • Writes the resource to the HTTP response – gzip compression – set response headers: last modified, content type, ... 18 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 19. Serving Spring JS Files • Spring JS distributed as a jar – bundles JavaScript, CSS, and other resources • Serve them with the ResourceServlet • Possible to override bundled resources – include your own in the webapp root <servlet> <servlet-name>Resources Servlet</servlet-name> <servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Resources Servlet</servlet-name> <url-pattern>/resources/*</url-pattern> </servlet-mapping> 19 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 20. Spring JS Resources • Underlying library – /resources/dojo/dojo.js • Public API – /resources/spring/Spring.js • Toolkit-specific implementation – /resources/spring/Spring-Dojo.js • Additional underlying library resources – /resources/dijit/themes/tundra/tundra.css 20 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 21. Including Spring JS On a Page • Include required files <link type="text/css" rel="stylesheet" href="<c:url value="/resources/dijit/themes/tundra/tundra.css" />" /> <script type="text/javascript" src ="<c:url value="/resources/dojo/dojo.js" />"><script/> <script type="text/javascript" src ="<c:url value="/resources/spring/Spring.js" />"><script/> <script type="text/javascript" src ="<c:url value="/resources/spring/Spring-Dojo.js" />"><script/> • Add Dojo “tundra” style to body tag <body class="tundra" > ... 21 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 22. Topics in this session • Overview of Ajax • Introduction to Spring JS • Spring JS Building Blocks • Spring JS Advanced Solutions • Spring JS + RESTful MVC 22 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 23. Enhancing a DOM Node • DOM nodes can be manipulated – decorate with new look and/or behavior – via JS and CSS • A common technique for “enhancing” plain HTML – separates static from dynamic parts – easier to understand & maintain • Supported by underlying toolkit – e.g. turn HTML form fields to rich widgets 23 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 24. Spring JS Decorations • Mechanism for DOM node enhancements – abstracts underlying toolkit • A function for applying decorations – Spring.addDecoration(/*Object*/decoration) • Several available decorations – Element decoration – Ajax event decoration – Validate All decoration 24 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 25. Fragment Rendering • An Ajax call refreshes parts of a page – response must contain a “fragment” – not HTML for entire page • Yet controllers should not be aware of Ajax – easier to maintain that way • Spring JS provides special Spring MVC view – renders a fragment of the response only – works transparently 25 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 26. The “Fragments” Parameter • Ajax event decoration submits special parameter – a hint for what HTML to be rendered • Server notices special parameter – renders only specified fragment • Composition-based view technology is required – currently JSP/Tiles supported only – fragment names match to a Tiles attribute 26 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 27. Built-In Response Handling Types • Refresh portions of the page – grab top-level DOM nodes – replace equivalent nodes on existing page • Present Ajax popup – a modal dialog with the returned HTML – enable via AjaxEventDecoration “popup” attribute • Client side redirect – detects server response requesting client-side redirect – requires AjaxUrlBasedViewResolver 27 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 28. Demo Spring JS Building Blocks SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 29. Topics in this session • Overview of Ajax • Introduction to Spring JS • Spring JS Building Blocks • Spring JS Advanced Solutions • Spring JS + RESTful MVC 29 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 30. Common Questions • The fundamental pieces of Spring JS seem nice, but how do I... – perform custom response handling? – make my code more terse? – keep things DRY? – organize and modularize my growing amount of JavaScript code? 30 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 31. Demo Spring JS Advanced Solutions SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 32. Topics in this session • Overview of Ajax • Introduction to Spring JS • Spring JS Building Blocks • Spring JS Advanced Solutions • Spring JS + RESTful MVC 32 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 33. The Evolving Web Platform • Capable browsers with advanced JavaScript VM’s are becoming more commonplace – Safari, Firefox, and Chrome – Webkit-based mobile browsers • As the platform evolves, boundaries can be pushed further on the client – see Canvas, SVG, Video in HTML 5 • RESTful services provide the perfect compliment on the server-side – JSON representations easy to consume 33 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 34. JSON support in Spring 3.0 • MappingJacksonJsonView – renders the model as JSON – customizable via annotations – high-performance • MappingJacksonHttpMessageConverter – easy binding from a JSON payload 34 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 35. Demo Consuming RESTful Services SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 36. Summary • Spring MVC very useful for Ajax – a swiss-army knife • Spring JS provides simple abstraction – builds on existing Ajax toolkits – provides both client and server side components • Many common enterprise scenarios made easy – rich forms – partial page updates – Ajax popups – JSON 36 SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  • 37. Q&A SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.