SlideShare a Scribd company logo
1 of 29
Download to read offline
Ajax Integration Guide for
                  Spring Enterprise Applications




Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.


                                                                                                                     1
Introduction

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




Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   2
                                                                                                                         2
Our Open Source Projects




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   3
                                                                                                                         3
Spring Uptake

                                                                                                                     Cumulative downloads (Sourceforge-only)

                                                                                                                         3,000,000


                                                                                                                         2,250,000


                                                                                                                         1,500,000


                                                                                                                          750,000


                                                                                                                                0




                                                                                                                                     11/1/03
                                                                                                                                      1/1/08
                                                                                                                                      8/1/07
                                                                                                                                      3/1/07
                                                                                                                                     10/1/06
                                                                                                                                      5/1/06
                                                                                                                                     12/1/05
                                                                                                                                      7/1/05
                                                                                                                                      2/1/05
                                                                                                                                      9/1/04
                                                                                                                                      4/1/04
                                     64% of enterprises using Spring
                              source: BEA dev2dev survey



Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.                                     4
                                                                                                                                                               4
Our Commercial Products



                                                         Spring                                                SpringSource
                                                       Enterprise                                              Performance
                                                        Edition                                                    Suite




                                                                            SpringSource
                                                                             Enterprise


                                                                                   SpringSource
                                                                                     Support




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.            5
                                                                                                                                  5
Application Server




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   6
                                                                                                                         6
Topics


       • A Plethora of Choices
                 – JavaScript libraries
                 – JSF components
                 – RIA remoting
       • Approaches to integration with Spring
                 – Spring                        JavaScript
                 – Spring                        Faces
                 – Spring                        MVC – RESTful @Controller
                 – Spring                        Flex?


Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   7
                                                                                                                         7
The State of Ajax Today


      • Too much choice?




Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   8
                                                                                                                         8
How Do We Choose a
JavaScript Library???

       • Important Features:
                 – Ease of use / Quality of documentation
                 – Supports unobtrusive use / progressive
                   enhancement
                 – Support for accessibility
                 – Consistent cross-browser support
                 – Vibrant community
                 – Optimized for good performance
                 – Easy to integrate with Java / Spring


Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   9
                                                                                                                         9
The Cream Is Rising...


       • The major players that are starting to
         seperate themselves from the rest:
                 – Prototype / Scriptaculous
                 – jQuery
                 – YUI
                 – Ext
                 – Dojo




Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   10
                                                                                                                          10
Dojo – Our First Choice


       • A complete framework that combines the low-level
         utility of Prototype / jQuery with an extensive
         collection of UI widgets.

       • A modular packaging system that allows you to
         “import” other modules, similar to Java's package
         system.

       • Pioneering support for accessibility in their widget
         system
                 – ARIA


Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   11
                                                                                                                          11
Commonalities

       • All of these frameworks are about more than just the
         asynchronous exchange of data with the server.

       • They all focus on improving the quality of your
         client-side code and enabling you to bring a better
         experience to your users.

       • They are all able to be used in an unobtrusive
         manner to provide a progressively enhanced UI
          – Requires careful design.



Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   12
                                                                                                                          12
Connecting to Spring


       • There are a number of effective
         techniques available for connecting your
         Ajax-enhanced UI to take advantage of
         Spring-based server-side resources

       • It is important to strike the right balance
         between processing on the client and
         processing on the server.



Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   13
                                                                                                                          13
The Progressive Approach


       • Ideally take advantage of the existing
         controller infrastructure.

       • We want to have an application that is
         able to maintain the same functionality
         without Ajax as it does with Ajax.
                 – Progressively enhanced
                 – Focus on accessibility



Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   14
                                                                                                                          14
Spring Web




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
                                                                                                                     15
                                                                                                                     11
                                                                                                                          15
Spring JavaScript

         • New module introduced in the Web Flow 2
           Distribution

         • JavaScript abstraction framework that allows you to
           progressively enhance a web page with behavior
            – Consists of a public .js API and implementation

         • Builds on Dojo, other implementations possible
           (jQuery probably next)

         • Handle the 80% case, while not hiding the
           underlying library

         • API can be used directly, or used by a tag lib
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
                                                                                                                     12
                                                                                                                     16
                                                                                                                          16
Spring JavaScript

          • Focus on progressive enhancement
                    – A more pragmatic approach than full RIA


          • Support for partial fragment rendering
            from Spring MVC through AjaxTilesView

          • Dojo (optimized build) and CSS
            Framework packaged for convenience
            and served by the ResourceServlet
                    – Yahoo performance guidelines baked in

Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
                                                                                                                     13
                                                                                                                     17
                                                                                                                          17
Element Decoration Example


          <form:input path=quot;creditCardNumberquot;/>
          <script type=quot;text/javascriptquot;>
            Spring.addDecoration(new Spring.ElementDecoration({
                   elementId : quot;creditCardNumberquot;,
                   widgetType : quot;dijit.form.ValidationTextBoxquot;,
                   widgetAttrs : {
                           invalidMessage : quot;Invalid credit card number!quot;,
                           regExp : quot;d{16}quot;,
                           required : true
                   }
            }));
          <script/>




Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   18
                                                                                                                          18
AJAX Event Decoration
  Example

      • Link decoration
                <a id=quot;nextUrlquot; href=quot;...quot;>Next Page</a>

                <script type=quot;text/javascriptquot;>
                   Spring.addDecoration(new Spring.AjaxEventDecoration({
                         elementId : quot;nextUrlquot;,
                         event : quot;onclickquot; }));
                </script>




Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
                                                                                                                          19
Spring Booking-MVC




                                                   Code Examples and Demo




Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   20
                                                                                                                          20
JSF - Another level of
abstraction...

       • JSF components can provide another
         level of abstraction to allow you to add
         Ajax functionality in a more declarative
         manner.
                 – Established libraries such as ICEFaces and
                   Ajax4JSF
                 – Spring Faces
                            • Aims to ease the integration burden by being
                              compatible with leading Javascript frameworks.
                            • Builds on Spring JS



Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   21
                                                                                                                          21
Spring Faces




                                                   Code Examples and Demo




Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   22
                                                                                                                          22
RESTful Spring

      • REST is an important piece of the evolving Spring
        Web ecosystem.
         – Central theme in Spring 3.0

      • Provide different representations of the same
        resource.
                – HTML for full page display or partial DOM update.
                – JSON for intelligent widgets such as the Dojo
                  table widget.
                   • dojo.data
                – Any content type is possible



Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   23
                                                                                                                          23
RESTful @Controller
@RequestMapping(value=quot;/hotelsquot;, method=RequestMethod.GET)
public String getHotels(ModelMap model) {
  List<Hotel> hotels = hotelService.getHotels();
  model.addAttribute(quot;hotelsquot;, hotels);
  return quot;hotelsquot;;
}

@RequestMapping(value=quot;/hotels/{hotel}quot;, method=RequestMethod.PUT)‫‏‬
public void updateHotel(@UriParam(quot;hotelquot;)long id, Hotel hotel) {
  hotelService.updateHotel(id, hotel);
}

@RequestMapping(value=quot;/hotels/{hotel}/bookings/{booking}quot;, method=RequestMethod.GET)
public String getBooking(@UriParam(quot;hotelquot;)long hotelId, @UriParam(quot;bookingquot;)long
bookingId, ModelMap model) {
  Hotel hotel = hotelService.getHotel(hotelId);
  Booking booking = hotel.getBooking(bookingId);
  model.addAttribute(quot;bookingquot;, booking);
  return quot;bookingquot;;
}

@RequestMapping(value=quot;/hotels/{hotel}/bookingsquot;, method=RequestMethod.POST)‫‏‬
public void addBooking(@UriParam(quot;hotelquot;)long hotelId, Booking booking) {
 // store booking
}
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   24
                                                                                                                          24
RESTful Spring




                                                   Code Examples and Demo




Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   25
                                                                                                                          25
RIA Remoting - Spring Flex?

      • Basic approaches to integration available now
                – Adobe's BlazeDS and LiveCycle Data Services
                – GraniteDS


      • Would be interesting to reduce the conceptual
        overhead
                – Reduce configuration required
                – Expose Spring beans directly


      • Prototyping deeper BlazeDS integration for the
        Spring 3.0 timeframe



Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   26
                                                                                                                          26
Spring Flex?




                                                   Code Examples and Demo




Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   27
                                                                                                                          27
Summary

      • Spring has always emphasized choice
         – No different with Ajax and RIA
         – Same Spring service infrastructure for any
           client type

      • Spring MVC's flexible infrastructure makes it
        well-suited to Ajax and RIA

      • Choose the client-side technology based on
        merit and fit for application requirements



Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   28
                                                                                                                          28
Resources

      • Spring Framework and Spring Web Flow distros:

              http://www.springframework.org/downloads

      • Dojo

              http://www.dojotoolkit.org

      • Adobe BlazeDS

              http://opensource.adobe.com/wiki/display/blazeds/BlazeDS/




Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   29
                                                                                                                          29

More Related Content

Viewers also liked

I Phone Presentation Jan Linden Gips
I Phone Presentation Jan Linden GipsI Phone Presentation Jan Linden Gips
I Phone Presentation Jan Linden Gips
rajivmordani
 
Ajax World West I Phone Summit
Ajax World West I Phone SummitAjax World West I Phone Summit
Ajax World West I Phone Summit
rajivmordani
 
Laird Best Practices Ajax World West2008
Laird Best Practices Ajax World West2008Laird Best Practices Ajax World West2008
Laird Best Practices Ajax World West2008
rajivmordani
 
Ajax World2008 Eric Farrar
Ajax World2008 Eric FarrarAjax World2008 Eric Farrar
Ajax World2008 Eric Farrar
rajivmordani
 
08 10 12 Meebo Ajaxworld Preso
08 10 12 Meebo Ajaxworld Preso08 10 12 Meebo Ajaxworld Preso
08 10 12 Meebo Ajaxworld Preso
rajivmordani
 

Viewers also liked (6)

I Phone Presentation Jan Linden Gips
I Phone Presentation Jan Linden GipsI Phone Presentation Jan Linden Gips
I Phone Presentation Jan Linden Gips
 
Ajax World West I Phone Summit
Ajax World West I Phone SummitAjax World West I Phone Summit
Ajax World West I Phone Summit
 
Laird Best Practices Ajax World West2008
Laird Best Practices Ajax World West2008Laird Best Practices Ajax World West2008
Laird Best Practices Ajax World West2008
 
Ajax World2008 Eric Farrar
Ajax World2008 Eric FarrarAjax World2008 Eric Farrar
Ajax World2008 Eric Farrar
 
08 10 12 Meebo Ajaxworld Preso
08 10 12 Meebo Ajaxworld Preso08 10 12 Meebo Ajaxworld Preso
08 10 12 Meebo Ajaxworld Preso
 
Jsf Ajax
Jsf AjaxJsf Ajax
Jsf Ajax
 

Similar to Ajax Integration Guide

Use Data to Win New Business Presentation
Use Data to Win New Business PresentationUse Data to Win New Business Presentation
Use Data to Win New Business Presentation
Experian Hitwise
 
C1.3. Meeting of G20 Agricultural Chied Scientists (MACS)
C1.3. Meeting of G20 Agricultural Chied Scientists (MACS)C1.3. Meeting of G20 Agricultural Chied Scientists (MACS)
C1.3. Meeting of G20 Agricultural Chied Scientists (MACS)
GCARD Conferences
 

Similar to Ajax Integration Guide (10)

SAP HANA For Genome Data Processing: A Deep Dive
SAP HANA For Genome Data Processing: A Deep DiveSAP HANA For Genome Data Processing: A Deep Dive
SAP HANA For Genome Data Processing: A Deep Dive
 
Demystifying Flexible Staffing's Role in Today's Labor Market & Economy
Demystifying Flexible Staffing's Role in Today's Labor Market & EconomyDemystifying Flexible Staffing's Role in Today's Labor Market & Economy
Demystifying Flexible Staffing's Role in Today's Labor Market & Economy
 
July Tatum Survey - Recovery Stalls
July Tatum Survey - Recovery StallsJuly Tatum Survey - Recovery Stalls
July Tatum Survey - Recovery Stalls
 
Jun 2009 Tatum Survey
Jun 2009 Tatum SurveyJun 2009 Tatum Survey
Jun 2009 Tatum Survey
 
Aug 2009 Tatum Survey
Aug 2009 Tatum SurveyAug 2009 Tatum Survey
Aug 2009 Tatum Survey
 
USA LATAM Road Show
USA LATAM Road ShowUSA LATAM Road Show
USA LATAM Road Show
 
Use Data to Win New Business Presentation
Use Data to Win New Business PresentationUse Data to Win New Business Presentation
Use Data to Win New Business Presentation
 
Future Challenges for Big Pharma
Future Challenges for Big PharmaFuture Challenges for Big Pharma
Future Challenges for Big Pharma
 
Change How You Design Software2011 at UENP
Change How You Design Software2011 at UENPChange How You Design Software2011 at UENP
Change How You Design Software2011 at UENP
 
C1.3. Meeting of G20 Agricultural Chied Scientists (MACS)
C1.3. Meeting of G20 Agricultural Chied Scientists (MACS)C1.3. Meeting of G20 Agricultural Chied Scientists (MACS)
C1.3. Meeting of G20 Agricultural Chied Scientists (MACS)
 

More from rajivmordani

Web 2 0 Data Visualization With Jsf
Web 2 0 Data Visualization With JsfWeb 2 0 Data Visualization With Jsf
Web 2 0 Data Visualization With Jsf
rajivmordani
 
X Aware Ajax World V1
X Aware Ajax World V1X Aware Ajax World V1
X Aware Ajax World V1
rajivmordani
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
rajivmordani
 
Tripit Ajaxworld V5
Tripit Ajaxworld V5Tripit Ajaxworld V5
Tripit Ajaxworld V5
rajivmordani
 
Turbo Enterprise Web 2.0 Ajax World 20081
Turbo Enterprise Web 2.0 Ajax World 20081Turbo Enterprise Web 2.0 Ajax World 20081
Turbo Enterprise Web 2.0 Ajax World 20081
rajivmordani
 
Sue Googe Spice Up Ux
Sue Googe Spice Up UxSue Googe Spice Up Ux
Sue Googe Spice Up Ux
rajivmordani
 
Social Networking Intranet
Social Networking IntranetSocial Networking Intranet
Social Networking Intranet
rajivmordani
 
Practical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter SvenssonPractical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter Svensson
rajivmordani
 
Server Side Javascript
Server Side JavascriptServer Side Javascript
Server Side Javascript
rajivmordani
 
Slow Cool 20081009 Final
Slow Cool 20081009 FinalSlow Cool 20081009 Final
Slow Cool 20081009 Final
rajivmordani
 
Pushing Datatothe Browserwith Comet Ajax W
Pushing Datatothe Browserwith Comet Ajax WPushing Datatothe Browserwith Comet Ajax W
Pushing Datatothe Browserwith Comet Ajax W
rajivmordani
 
I Phone Dev Summit Prezo Guy Naor Final
I Phone Dev Summit Prezo Guy Naor FinalI Phone Dev Summit Prezo Guy Naor Final
I Phone Dev Summit Prezo Guy Naor Final
rajivmordani
 
Netapp Michael Galpin
Netapp Michael GalpinNetapp Michael Galpin
Netapp Michael Galpin
rajivmordani
 
Mike Grushin Developing Ugc Sites That Scale
Mike Grushin    Developing Ugc Sites That ScaleMike Grushin    Developing Ugc Sites That Scale
Mike Grushin Developing Ugc Sites That Scale
rajivmordani
 
Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1
rajivmordani
 
Good Parts of JavaScript Douglas Crockford
Good Parts of JavaScript Douglas CrockfordGood Parts of JavaScript Douglas Crockford
Good Parts of JavaScript Douglas Crockford
rajivmordani
 
Flying Pixels Ent Apps Jeremy Chone
Flying Pixels Ent Apps Jeremy ChoneFlying Pixels Ent Apps Jeremy Chone
Flying Pixels Ent Apps Jeremy Chone
rajivmordani
 

More from rajivmordani (20)

Web 2 0 Data Visualization With Jsf
Web 2 0 Data Visualization With JsfWeb 2 0 Data Visualization With Jsf
Web 2 0 Data Visualization With Jsf
 
X Aware Ajax World V1
X Aware Ajax World V1X Aware Ajax World V1
X Aware Ajax World V1
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
 
Tripit Ajaxworld V5
Tripit Ajaxworld V5Tripit Ajaxworld V5
Tripit Ajaxworld V5
 
Turbo Enterprise Web 2.0 Ajax World 20081
Turbo Enterprise Web 2.0 Ajax World 20081Turbo Enterprise Web 2.0 Ajax World 20081
Turbo Enterprise Web 2.0 Ajax World 20081
 
Sue Googe Spice Up Ux
Sue Googe Spice Up UxSue Googe Spice Up Ux
Sue Googe Spice Up Ux
 
Social Networking Intranet
Social Networking IntranetSocial Networking Intranet
Social Networking Intranet
 
Ssjs Presentation
Ssjs PresentationSsjs Presentation
Ssjs Presentation
 
Practical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter SvenssonPractical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter Svensson
 
Server Side Javascript
Server Side JavascriptServer Side Javascript
Server Side Javascript
 
Ria Enterprise
Ria EnterpriseRia Enterprise
Ria Enterprise
 
Slow Cool 20081009 Final
Slow Cool 20081009 FinalSlow Cool 20081009 Final
Slow Cool 20081009 Final
 
Pushing Datatothe Browserwith Comet Ajax W
Pushing Datatothe Browserwith Comet Ajax WPushing Datatothe Browserwith Comet Ajax W
Pushing Datatothe Browserwith Comet Ajax W
 
I Phone Dev Summit Prezo Guy Naor Final
I Phone Dev Summit Prezo Guy Naor FinalI Phone Dev Summit Prezo Guy Naor Final
I Phone Dev Summit Prezo Guy Naor Final
 
Netapp Michael Galpin
Netapp Michael GalpinNetapp Michael Galpin
Netapp Michael Galpin
 
Mike Grushin Developing Ugc Sites That Scale
Mike Grushin    Developing Ugc Sites That ScaleMike Grushin    Developing Ugc Sites That Scale
Mike Grushin Developing Ugc Sites That Scale
 
Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1
 
Good Parts of JavaScript Douglas Crockford
Good Parts of JavaScript Douglas CrockfordGood Parts of JavaScript Douglas Crockford
Good Parts of JavaScript Douglas Crockford
 
Flying Pixels Ent Apps Jeremy Chone
Flying Pixels Ent Apps Jeremy ChoneFlying Pixels Ent Apps Jeremy Chone
Flying Pixels Ent Apps Jeremy Chone
 
I Phone Dev
I Phone DevI Phone Dev
I Phone Dev
 

Recently uploaded

Recently uploaded (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 
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
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Ajax Integration Guide

  • 1. Ajax Integration Guide for Spring Enterprise Applications Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 1
  • 2. Introduction • Who am I??? – Jeremy Grelle • Senior Software Engineer, SpringSource • Member of Spring Web Products team in Melbourne, FL. • Lead of Spring Faces, Spring JavaScript, JSF 2.0 EG member. • SpringSource's resident RIA ninja. • Rock Star / Geek Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 2 2
  • 3. Our Open Source Projects Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 3 3
  • 4. Spring Uptake Cumulative downloads (Sourceforge-only) 3,000,000 2,250,000 1,500,000 750,000 0 11/1/03 1/1/08 8/1/07 3/1/07 10/1/06 5/1/06 12/1/05 7/1/05 2/1/05 9/1/04 4/1/04 64% of enterprises using Spring source: BEA dev2dev survey Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 4 4
  • 5. Our Commercial Products Spring SpringSource Enterprise Performance Edition Suite SpringSource Enterprise SpringSource Support Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 5 5
  • 6. Application Server Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 6 6
  • 7. Topics • A Plethora of Choices – JavaScript libraries – JSF components – RIA remoting • Approaches to integration with Spring – Spring JavaScript – Spring Faces – Spring MVC – RESTful @Controller – Spring Flex? Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 7 7
  • 8. The State of Ajax Today • Too much choice? Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 8 8
  • 9. How Do We Choose a JavaScript Library??? • Important Features: – Ease of use / Quality of documentation – Supports unobtrusive use / progressive enhancement – Support for accessibility – Consistent cross-browser support – Vibrant community – Optimized for good performance – Easy to integrate with Java / Spring Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 9 9
  • 10. The Cream Is Rising... • The major players that are starting to seperate themselves from the rest: – Prototype / Scriptaculous – jQuery – YUI – Ext – Dojo Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 10 10
  • 11. Dojo – Our First Choice • A complete framework that combines the low-level utility of Prototype / jQuery with an extensive collection of UI widgets. • A modular packaging system that allows you to “import” other modules, similar to Java's package system. • Pioneering support for accessibility in their widget system – ARIA Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 11 11
  • 12. Commonalities • All of these frameworks are about more than just the asynchronous exchange of data with the server. • They all focus on improving the quality of your client-side code and enabling you to bring a better experience to your users. • They are all able to be used in an unobtrusive manner to provide a progressively enhanced UI – Requires careful design. Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 12 12
  • 13. Connecting to Spring • There are a number of effective techniques available for connecting your Ajax-enhanced UI to take advantage of Spring-based server-side resources • It is important to strike the right balance between processing on the client and processing on the server. Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 13 13
  • 14. The Progressive Approach • Ideally take advantage of the existing controller infrastructure. • We want to have an application that is able to maintain the same functionality without Ajax as it does with Ajax. – Progressively enhanced – Focus on accessibility Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 14 14
  • 15. Spring Web Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 15 11 15
  • 16. Spring JavaScript • New module introduced in the Web Flow 2 Distribution • JavaScript abstraction framework that allows you to progressively enhance a web page with behavior – Consists of a public .js API and implementation • Builds on Dojo, other implementations possible (jQuery probably next) • Handle the 80% case, while not hiding the underlying library • API can be used directly, or used by a tag lib Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 12 16 16
  • 17. Spring JavaScript • Focus on progressive enhancement – A more pragmatic approach than full RIA • Support for partial fragment rendering from Spring MVC through AjaxTilesView • Dojo (optimized build) and CSS Framework packaged for convenience and served by the ResourceServlet – Yahoo performance guidelines baked in Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 13 17 17
  • 18. Element Decoration Example <form:input path=quot;creditCardNumberquot;/> <script type=quot;text/javascriptquot;> Spring.addDecoration(new Spring.ElementDecoration({ elementId : quot;creditCardNumberquot;, widgetType : quot;dijit.form.ValidationTextBoxquot;, widgetAttrs : { invalidMessage : quot;Invalid credit card number!quot;, regExp : quot;d{16}quot;, required : true } })); <script/> Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 18 18
  • 19. AJAX Event Decoration Example • Link decoration <a id=quot;nextUrlquot; href=quot;...quot;>Next Page</a> <script type=quot;text/javascriptquot;> Spring.addDecoration(new Spring.AjaxEventDecoration({ elementId : quot;nextUrlquot;, event : quot;onclickquot; })); </script> Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19 19
  • 20. Spring Booking-MVC Code Examples and Demo Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 20 20
  • 21. JSF - Another level of abstraction... • JSF components can provide another level of abstraction to allow you to add Ajax functionality in a more declarative manner. – Established libraries such as ICEFaces and Ajax4JSF – Spring Faces • Aims to ease the integration burden by being compatible with leading Javascript frameworks. • Builds on Spring JS Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 21 21
  • 22. Spring Faces Code Examples and Demo Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 22 22
  • 23. RESTful Spring • REST is an important piece of the evolving Spring Web ecosystem. – Central theme in Spring 3.0 • Provide different representations of the same resource. – HTML for full page display or partial DOM update. – JSON for intelligent widgets such as the Dojo table widget. • dojo.data – Any content type is possible Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 23 23
  • 24. RESTful @Controller @RequestMapping(value=quot;/hotelsquot;, method=RequestMethod.GET) public String getHotels(ModelMap model) { List<Hotel> hotels = hotelService.getHotels(); model.addAttribute(quot;hotelsquot;, hotels); return quot;hotelsquot;; } @RequestMapping(value=quot;/hotels/{hotel}quot;, method=RequestMethod.PUT)‫‏‬ public void updateHotel(@UriParam(quot;hotelquot;)long id, Hotel hotel) { hotelService.updateHotel(id, hotel); } @RequestMapping(value=quot;/hotels/{hotel}/bookings/{booking}quot;, method=RequestMethod.GET) public String getBooking(@UriParam(quot;hotelquot;)long hotelId, @UriParam(quot;bookingquot;)long bookingId, ModelMap model) { Hotel hotel = hotelService.getHotel(hotelId); Booking booking = hotel.getBooking(bookingId); model.addAttribute(quot;bookingquot;, booking); return quot;bookingquot;; } @RequestMapping(value=quot;/hotels/{hotel}/bookingsquot;, method=RequestMethod.POST)‫‏‬ public void addBooking(@UriParam(quot;hotelquot;)long hotelId, Booking booking) { // store booking } Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 24 24
  • 25. RESTful Spring Code Examples and Demo Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 25 25
  • 26. RIA Remoting - Spring Flex? • Basic approaches to integration available now – Adobe's BlazeDS and LiveCycle Data Services – GraniteDS • Would be interesting to reduce the conceptual overhead – Reduce configuration required – Expose Spring beans directly • Prototyping deeper BlazeDS integration for the Spring 3.0 timeframe Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 26 26
  • 27. Spring Flex? Code Examples and Demo Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 27 27
  • 28. Summary • Spring has always emphasized choice – No different with Ajax and RIA – Same Spring service infrastructure for any client type • Spring MVC's flexible infrastructure makes it well-suited to Ajax and RIA • Choose the client-side technology based on merit and fit for application requirements Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 28 28
  • 29. Resources • Spring Framework and Spring Web Flow distros: http://www.springframework.org/downloads • Dojo http://www.dojotoolkit.org • Adobe BlazeDS http://opensource.adobe.com/wiki/display/blazeds/BlazeDS/ Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 29 29