SlideShare a Scribd company logo
1 of 22
Ajax on Struts 2
About Myself

 ●   Chad Davis
 ●   Blackdog Software, Inc.
 ●   J2EE Consulting
 ●   Corporate Training
 ●   Struts 2 in Action
 ●   Open Source Enthusiast
 ●   Debian Devotee
Road Map

●   Something for everyone
●   Struts 2 introduction
●   Ajax introduction
●   Walk through a code sample
●   Questions at any time
Struts 2

●   Web application framework
●   Java Servlets
●   Second generation
●   Software engineering
Classic versus Ajax

    Classic Web Applications
    •



    Ajax Web Applications
    •
Classic Web Applications                            < htm l>
                                                     < head>
                                                       < link rel= quot;stylesheetquot; type= quot;text/cssquot; href= quot;css/ajaxUserBrowser.cssquot; />
                                                     < /head>
                                                     < body>
                                                       < h2> Artist Browser Control< /h2>
                                                       < form nam e= quot;ClassicRetrieveUserquot; action= quot;ClassicRetrieveUser.actionquot;
                                                                                  m ethod= quot;postquot;>
                                                        < select nam e= quot;usernam equot; id= quot;ClassicRetrieveUser_usernam equot;>
                                                        < option value= quot;Jim m yquot;> Jim m y< /option>
                                                        < option value= quot;Charlie Joequot;> Charlie Joe< /option>
                                                        < option value= quot;Maryquot; selected= quot;selectedquot;> Mary< /option>
                                                        < option value= quot;Artyquot;> Arty< /option>
                                                       < /form >
                                                     < /body>
                                                    < /htm l>




URL: /manningSampleApp/chapterEight/ClassicRetrieveUser.action
Data: username=mary
How it works: classic style

●   Browser makes request
    –   Http
    –   URL
    –   Data
●   Server
    –   Processes data
    –   Sends HTML page response
●   Browser receives, renders HTML
<html>
<head>
<link rel=quot;stylesheetquot; type=quot;text/cssquot; href=quot;css/classicUserBrowser.cssquot; />
</head>
<body>
<h2>Artist Browser Control</h2>
<form id=quot;ClassicRetrieveUserquot; name=quot;ClassicRetrieveUserquot; onsubmit=quot;return true;quot;
    action=quot;/manningSampleApp/chapterEight/ClassicRetrieveUser.actionquot; method=quot;postquot;>
<table class=quot;wwFormTablequot;>
    <tr>
        <td class=quot;tdLabelquot;><label for=quot;ClassicRetrieveUser_usernamequot; class=quot;labelquot;>Select an artist:</label></td>
        <td><select name=quot;usernamequot; id=quot;ClassicRetrieveUser_usernamequot;>
            <option value=quot;Jimmyquot;>Jimmy</option>
            <option value=quot;Charlie Joequot;>Charlie Joe</option>
            <option value=quot;Maryquot; selected=quot;selectedquot;>Mary</option>
            <option value=quot;Artyquot;>Arty</option>
        </select></td>
    </tr>
    <tr>
        <td colspan=quot;2quot;>
        <div align=quot;rightquot;><input type=quot;submitquot; id=quot;ClassicRetrieveUser_0quot; value=quot;Submitquot; /></div>
        </td>
    </tr>
</table>
</form>
<hr/>
<h2>Artist Information</h2>
<div id='console'>
<p><span class=quot;browser_labelquot;>Name:</span> Mary Greene</p>
<p><span class=quot;browser_labelquot;>PortfolioName: </span>Wood Cuts</p>
<p><span class=quot;browser_labelquot;>PortfolioName: </span>Oil Paintings</p>
</div>
</body>
</html>
Classic Problems

●   Slow
●   High bandwidth
●   Redundant
●   Page rendering
Ajax Web Applications                              {quot;artistquot;:
                                                             {
                                                                 quot;usernamequot;:quot;Maryquot;,
                                                                 quot;passwordquot;:quot;maxquot;,
                                                                 quot;portfolioNamequot;:quot;Mary's Portfolioquot;,
                                                                 quot;birthdayquot;:quot;2008-10-29 15:10:25.857MDTquot;,
                                                                 quot;firstNamequot;:quot;Maryquot;,
                                                                 quot;lastNamequot;:quot;Greenequot;,
                                                                 quot;receiveJunkMailquot;:quot;falsequot;,
                                                            }
                                                   }




URL: /manningSampleApp/chapterEight/ClassicRetrieveUser.action
Data: username=mary
How it works: Ajax

●   Browser uses Javascript to submit             request
    –   Http
    –   URL
    –   Data
●   Server
    –   Processes data
    –   Sends data response ( JSON, XML, etc. )
●   Browser Javascript
    –   Proceses data
    –   DHTML
{quot;artistquot;:
      {
             quot;usernamequot;:quot;Maryquot;,
             quot;passwordquot;:quot;maxquot;,
             quot;portfolioNamequot;:quot;Mary's Portfolioquot;,
             quot;birthdayquot;:quot;2008-10-29 15:10:25.857MDTquot;,
             quot;firstNamequot;:quot;Maryquot;,
             quot;lastNamequot;:quot;Greenequot;,
             quot;receiveJunkMailquot;:quot;falsequot;,
             quot;portfoliosquot;:{quot;entryquot;:[
                {quot;stringquot;:quot;Wood Cutsquot;, quot;manning.chapterEight.utils.Portfolioquot;:{quot;namequot;:quot;WoodCutsquot;}},
                {quot;stringquot;:quot;Oil Paintingsquot;, manning.chapterEight.utils.Portfolioquot;:{quot;namequot;:quot;Oil Paintingsquot;}}
             ]}
      }
}
Ajax Selling Points

●   Low bandwith
●   No page rendering issues
●   Supports a stronger Separation of Concerns
Observations . . .


  What does the server do?
  The page abstraction: JSP, ASP, PHP
  What should new frameworks do?
Struts 2 Architecture

●   Does all the dirty work for you
●   Separation of Concerns !!
●   Interceptors, Actions, Results, ValueStack
Daily development

●   Actions
    –   you write them
●   Results
    –   declare them
    –   write them if necessary
●   Interceptors
    –   nothing!
    –   declare or write if necessary
Configuration

●   Declare your actions
●   Declare your results
●   XML, Annotations
struts.xml
   <?xml version=quot;1.0quot; encoding=quot;UTF-8quot; ?>
   <!DOCTYPE struts PUBLIC quot;-//Apache Software Foundation//DTD Struts Configuration 2.0//ENquot;
                                                   quot;http://struts.apache.org/dtds/struts-2.0.dtdquot;>


   <struts>


     <package name=quot;chapterEightPublicquot; namespace=quot;/chapterEightquot; extends=quot;struts-defaultquot;>


         <action name=quot;ClassicUserBrowserquot; class=quot;manning.chapterEight.UserBrowserquot;>
               <result>classicUserBrowser.jsp</result>
         </action>


     </package>


   </struts>
Let's code: classic style


     What do we need to write?
            Interceptors?
              Results?
             An Action

             A JSP Page
Let's Code: Ajax Style


     What do we need to write?
             Interceptors?
                Results?
     An Action
     A JSP Page?
     Javascript Client Application
Summary
Ajax – Lower Bandwidth
Ajax – No Page Rendering
Ajax – Javascript Client
   Struts 2 – Second Generation Framework
Ajax – JSON,Built on Software Engineering Principles
   Struts 2 – XML
   Struts 2 – Fast Development, Flexible Architecture

More Related Content

What's hot

CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書
拓樹 谷
 
We9 Struts 2.0
We9 Struts 2.0We9 Struts 2.0
We9 Struts 2.0
wangjiaz
 
Teen Driving - Kimberly Stavropoulos
Teen Driving - Kimberly StavropoulosTeen Driving - Kimberly Stavropoulos
Teen Driving - Kimberly Stavropoulos
kimmymarie
 
ARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: RolloversARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: Rollovers
Gilbert Guerrero
 
Clave blanca
Clave blancaClave blanca
Clave blanca
bapes
 

What's hot (20)

Findability Bliss Through Web Standards
Findability Bliss Through Web StandardsFindability Bliss Through Web Standards
Findability Bliss Through Web Standards
 
Ajax
AjaxAjax
Ajax
 
HTML_HHC
HTML_HHCHTML_HHC
HTML_HHC
 
CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書
 
Illuminated Hacks -- Where 2.0 101 Tutorial
Illuminated Hacks -- Where 2.0 101 TutorialIlluminated Hacks -- Where 2.0 101 Tutorial
Illuminated Hacks -- Where 2.0 101 Tutorial
 
SlideShare Instant
SlideShare InstantSlideShare Instant
SlideShare Instant
 
SlideShare Instant
SlideShare InstantSlideShare Instant
SlideShare Instant
 
We9 Struts 2.0
We9 Struts 2.0We9 Struts 2.0
We9 Struts 2.0
 
Html5 101
Html5 101Html5 101
Html5 101
 
6주 javaScript 시작하며
6주  javaScript 시작하며6주  javaScript 시작하며
6주 javaScript 시작하며
 
Teen Driving - Kimberly Stavropoulos
Teen Driving - Kimberly StavropoulosTeen Driving - Kimberly Stavropoulos
Teen Driving - Kimberly Stavropoulos
 
ARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: RolloversARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: Rollovers
 
Efficient JavaScript Development
Efficient JavaScript DevelopmentEfficient JavaScript Development
Efficient JavaScript Development
 
Html5 intro
Html5 introHtml5 intro
Html5 intro
 
Clave blanca
Clave blancaClave blanca
Clave blanca
 
Boston Computing Review - Ruby on Rails
Boston Computing Review - Ruby on RailsBoston Computing Review - Ruby on Rails
Boston Computing Review - Ruby on Rails
 
Html5 101
Html5 101Html5 101
Html5 101
 
Cdddd
CddddCdddd
Cdddd
 
Html5
Html5Html5
Html5
 
BOOM Performance
BOOM PerformanceBOOM Performance
BOOM Performance
 

Viewers also liked

Zigbee network
Zigbee networkZigbee network
Zigbee network
bhavithd
 

Viewers also liked (16)

Embedded Linux Odp
Embedded Linux OdpEmbedded Linux Odp
Embedded Linux Odp
 
openHAB @ Eclipse DemoCamp Darmstadt
openHAB @ Eclipse DemoCamp DarmstadtopenHAB @ Eclipse DemoCamp Darmstadt
openHAB @ Eclipse DemoCamp Darmstadt
 
openHAB @ Devoxx 2012
openHAB @ Devoxx 2012openHAB @ Devoxx 2012
openHAB @ Devoxx 2012
 
IoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3B
 
Home Automation with LinkSprite IO
Home Automation with LinkSprite IOHome Automation with LinkSprite IO
Home Automation with LinkSprite IO
 
Board support package_on_linux
Board support package_on_linuxBoard support package_on_linux
Board support package_on_linux
 
Linux for embedded_systems
Linux for embedded_systemsLinux for embedded_systems
Linux for embedded_systems
 
Zig Bee
Zig BeeZig Bee
Zig Bee
 
Build your own block chain
Build your own block chainBuild your own block chain
Build your own block chain
 
Basics of Vhdl
Basics of VhdlBasics of Vhdl
Basics of Vhdl
 
Practical Applications of Block Chain Technologies
Practical Applications of Block Chain Technologies Practical Applications of Block Chain Technologies
Practical Applications of Block Chain Technologies
 
Zigbee network
Zigbee networkZigbee network
Zigbee network
 
Zigbee technology ppt edited
Zigbee technology ppt editedZigbee technology ppt edited
Zigbee technology ppt edited
 
Zigbee ppt
Zigbee pptZigbee ppt
Zigbee ppt
 
zigbee full ppt
zigbee full pptzigbee full ppt
zigbee full ppt
 
Zigbee Presentation
Zigbee PresentationZigbee Presentation
Zigbee Presentation
 

Similar to Ajax On S2 Odp

Solr and symfony in Harmony with SolrJs
Solr and symfony in Harmony with SolrJsSolr and symfony in Harmony with SolrJs
Solr and symfony in Harmony with SolrJs
Wildan Maulana
 
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity PresentationRails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
railsconf
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On Rails
Wen-Tien Chang
 
Doctype htmlcodigioooooo
Doctype htmlcodigiooooooDoctype htmlcodigioooooo
Doctype htmlcodigioooooo
ANDERSON FABIAN
 
07 Collada Overview
07 Collada Overview07 Collada Overview
07 Collada Overview
johny2008
 

Similar to Ajax On S2 Odp (20)

Plone Interactivity
Plone InteractivityPlone Interactivity
Plone Interactivity
 
Solr and symfony in Harmony with SolrJs
Solr and symfony in Harmony with SolrJsSolr and symfony in Harmony with SolrJs
Solr and symfony in Harmony with SolrJs
 
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity PresentationRails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
 
Haml, Sass & Compass
Haml, Sass & CompassHaml, Sass & Compass
Haml, Sass & Compass
 
Javascript Basic
Javascript BasicJavascript Basic
Javascript Basic
 
Widgets Tools Keynote
Widgets Tools KeynoteWidgets Tools Keynote
Widgets Tools Keynote
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax components
 
Microsoft ASP.NET 4.0 : What's Next?
Microsoft ASP.NET 4.0 : What's Next?Microsoft ASP.NET 4.0 : What's Next?
Microsoft ASP.NET 4.0 : What's Next?
 
Merb jQuery
Merb jQueryMerb jQuery
Merb jQuery
 
Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching Resurrected
 
Couch Db.0.9.0.Pub
Couch Db.0.9.0.PubCouch Db.0.9.0.Pub
Couch Db.0.9.0.Pub
 
Seam Glassfish Slidecast
Seam Glassfish SlidecastSeam Glassfish Slidecast
Seam Glassfish Slidecast
 
JQuery 101
JQuery 101JQuery 101
JQuery 101
 
Flickr Open Api Mashup
Flickr Open Api MashupFlickr Open Api Mashup
Flickr Open Api Mashup
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On Rails
 
Opensocial Codelab
Opensocial CodelabOpensocial Codelab
Opensocial Codelab
 
CSIS 138 Javascript Class1
CSIS 138 Javascript Class1CSIS 138 Javascript Class1
CSIS 138 Javascript Class1
 
Grddl In A Nutshell V1
Grddl In A Nutshell V1Grddl In A Nutshell V1
Grddl In A Nutshell V1
 
Doctype htmlcodigioooooo
Doctype htmlcodigiooooooDoctype htmlcodigioooooo
Doctype htmlcodigioooooo
 
07 Collada Overview
07 Collada Overview07 Collada Overview
07 Collada Overview
 

More from ghessler (7)

Joomla! Installation
Joomla! InstallationJoomla! Installation
Joomla! Installation
 
Joomla Presentation
Joomla PresentationJoomla Presentation
Joomla Presentation
 
Apache Commons Overview
Apache Commons OverviewApache Commons Overview
Apache Commons Overview
 
Overview Of Xaware
Overview Of XawareOverview Of Xaware
Overview Of Xaware
 
Gimp In Hollywood
Gimp In HollywoodGimp In Hollywood
Gimp In Hollywood
 
JCatapult
JCatapultJCatapult
JCatapult
 
Service Oriented Integration with ServiceMix
Service Oriented Integration with ServiceMixService Oriented Integration with ServiceMix
Service Oriented Integration with ServiceMix
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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)
 
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...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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
 

Ajax On S2 Odp

  • 2. About Myself ● Chad Davis ● Blackdog Software, Inc. ● J2EE Consulting ● Corporate Training ● Struts 2 in Action ● Open Source Enthusiast ● Debian Devotee
  • 3. Road Map ● Something for everyone ● Struts 2 introduction ● Ajax introduction ● Walk through a code sample ● Questions at any time
  • 4. Struts 2 ● Web application framework ● Java Servlets ● Second generation ● Software engineering
  • 5. Classic versus Ajax Classic Web Applications • Ajax Web Applications •
  • 6. Classic Web Applications < htm l> < head> < link rel= quot;stylesheetquot; type= quot;text/cssquot; href= quot;css/ajaxUserBrowser.cssquot; /> < /head> < body> < h2> Artist Browser Control< /h2> < form nam e= quot;ClassicRetrieveUserquot; action= quot;ClassicRetrieveUser.actionquot; m ethod= quot;postquot;> < select nam e= quot;usernam equot; id= quot;ClassicRetrieveUser_usernam equot;> < option value= quot;Jim m yquot;> Jim m y< /option> < option value= quot;Charlie Joequot;> Charlie Joe< /option> < option value= quot;Maryquot; selected= quot;selectedquot;> Mary< /option> < option value= quot;Artyquot;> Arty< /option> < /form > < /body> < /htm l> URL: /manningSampleApp/chapterEight/ClassicRetrieveUser.action Data: username=mary
  • 7. How it works: classic style ● Browser makes request – Http – URL – Data ● Server – Processes data – Sends HTML page response ● Browser receives, renders HTML
  • 8. <html> <head> <link rel=quot;stylesheetquot; type=quot;text/cssquot; href=quot;css/classicUserBrowser.cssquot; /> </head> <body> <h2>Artist Browser Control</h2> <form id=quot;ClassicRetrieveUserquot; name=quot;ClassicRetrieveUserquot; onsubmit=quot;return true;quot; action=quot;/manningSampleApp/chapterEight/ClassicRetrieveUser.actionquot; method=quot;postquot;> <table class=quot;wwFormTablequot;> <tr> <td class=quot;tdLabelquot;><label for=quot;ClassicRetrieveUser_usernamequot; class=quot;labelquot;>Select an artist:</label></td> <td><select name=quot;usernamequot; id=quot;ClassicRetrieveUser_usernamequot;> <option value=quot;Jimmyquot;>Jimmy</option> <option value=quot;Charlie Joequot;>Charlie Joe</option> <option value=quot;Maryquot; selected=quot;selectedquot;>Mary</option> <option value=quot;Artyquot;>Arty</option> </select></td> </tr> <tr> <td colspan=quot;2quot;> <div align=quot;rightquot;><input type=quot;submitquot; id=quot;ClassicRetrieveUser_0quot; value=quot;Submitquot; /></div> </td> </tr> </table> </form> <hr/> <h2>Artist Information</h2> <div id='console'> <p><span class=quot;browser_labelquot;>Name:</span> Mary Greene</p> <p><span class=quot;browser_labelquot;>PortfolioName: </span>Wood Cuts</p> <p><span class=quot;browser_labelquot;>PortfolioName: </span>Oil Paintings</p> </div> </body> </html>
  • 9. Classic Problems ● Slow ● High bandwidth ● Redundant ● Page rendering
  • 10. Ajax Web Applications {quot;artistquot;: { quot;usernamequot;:quot;Maryquot;, quot;passwordquot;:quot;maxquot;, quot;portfolioNamequot;:quot;Mary's Portfolioquot;, quot;birthdayquot;:quot;2008-10-29 15:10:25.857MDTquot;, quot;firstNamequot;:quot;Maryquot;, quot;lastNamequot;:quot;Greenequot;, quot;receiveJunkMailquot;:quot;falsequot;, } } URL: /manningSampleApp/chapterEight/ClassicRetrieveUser.action Data: username=mary
  • 11. How it works: Ajax ● Browser uses Javascript to submit request – Http – URL – Data ● Server – Processes data – Sends data response ( JSON, XML, etc. ) ● Browser Javascript – Proceses data – DHTML
  • 12. {quot;artistquot;: { quot;usernamequot;:quot;Maryquot;, quot;passwordquot;:quot;maxquot;, quot;portfolioNamequot;:quot;Mary's Portfolioquot;, quot;birthdayquot;:quot;2008-10-29 15:10:25.857MDTquot;, quot;firstNamequot;:quot;Maryquot;, quot;lastNamequot;:quot;Greenequot;, quot;receiveJunkMailquot;:quot;falsequot;, quot;portfoliosquot;:{quot;entryquot;:[ {quot;stringquot;:quot;Wood Cutsquot;, quot;manning.chapterEight.utils.Portfolioquot;:{quot;namequot;:quot;WoodCutsquot;}}, {quot;stringquot;:quot;Oil Paintingsquot;, manning.chapterEight.utils.Portfolioquot;:{quot;namequot;:quot;Oil Paintingsquot;}} ]} } }
  • 13. Ajax Selling Points ● Low bandwith ● No page rendering issues ● Supports a stronger Separation of Concerns
  • 14. Observations . . . What does the server do? The page abstraction: JSP, ASP, PHP What should new frameworks do?
  • 15. Struts 2 Architecture ● Does all the dirty work for you ● Separation of Concerns !! ● Interceptors, Actions, Results, ValueStack
  • 16.
  • 17. Daily development ● Actions – you write them ● Results – declare them – write them if necessary ● Interceptors – nothing! – declare or write if necessary
  • 18. Configuration ● Declare your actions ● Declare your results ● XML, Annotations
  • 19. struts.xml <?xml version=quot;1.0quot; encoding=quot;UTF-8quot; ?> <!DOCTYPE struts PUBLIC quot;-//Apache Software Foundation//DTD Struts Configuration 2.0//ENquot; quot;http://struts.apache.org/dtds/struts-2.0.dtdquot;> <struts> <package name=quot;chapterEightPublicquot; namespace=quot;/chapterEightquot; extends=quot;struts-defaultquot;> <action name=quot;ClassicUserBrowserquot; class=quot;manning.chapterEight.UserBrowserquot;> <result>classicUserBrowser.jsp</result> </action> </package> </struts>
  • 20. Let's code: classic style What do we need to write? Interceptors? Results? An Action A JSP Page
  • 21. Let's Code: Ajax Style What do we need to write? Interceptors? Results? An Action A JSP Page? Javascript Client Application
  • 22. Summary Ajax – Lower Bandwidth Ajax – No Page Rendering Ajax – Javascript Client Struts 2 – Second Generation Framework Ajax – JSON,Built on Software Engineering Principles Struts 2 – XML Struts 2 – Fast Development, Flexible Architecture

Editor's Notes

  1. Plus images, css, etc.This is a very small page.
  2. show amazon page refresh
  3. XMLHttpRequest