Your SlideShare is downloading. ×
Ajax ons2
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Ajax ons2

396
views

Published on

Ajax on Struts 2

Ajax on Struts 2

Published in: Technology, Education

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
396
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Plus images, css, etc. This is a very small page.
  • show amazon page refresh
  • XMLHttpRequest
  • Transcript

    • 1. Ajax on Struts 2
    • 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 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;stylesheet&quot; type = &quot;text/css&quot; href = &quot;css/classicUserBrowser.css&quot; /> </ head > < body > < h2 > Artist Browser Control </ h2 > < form id = &quot;ClassicRetrieveUser&quot; name = &quot;ClassicRetrieveUser&quot; onsubmit = &quot;return true;&quot; action = &quot;/manningSampleApp/chapterEight/ClassicRetrieveUser.action&quot; method = &quot;post&quot; > < table class = &quot;wwFormTable&quot; > < tr > < td class = &quot;tdLabel&quot; >< label for = &quot;ClassicRetrieveUser_username&quot; class = &quot;label&quot; > Select an artist: </ label ></ td > < td >< select name = &quot;username&quot; id = &quot;ClassicRetrieveUser_username&quot; > < option value = &quot;Jimmy&quot; > Jimmy </ option > < option value = &quot;Charlie Joe&quot; > Charlie Joe </ option > < option value = &quot;Mary&quot; selected = &quot;selected&quot; > Mary </ option > < option value = &quot;Arty&quot; > Arty </ option > </ select ></ td > </ tr > < tr > < td colspan = &quot;2&quot; > < div align = &quot;right&quot; >< input type = &quot;submit&quot; id = &quot;ClassicRetrieveUser_0&quot; value = &quot;Submit&quot; /></ div > </ td > </ tr > </ table > </ form > < hr /> < h2 > Artist Information </ h2 > < div id = 'console' > < p >< span class = &quot;browser_label&quot; > Name: </ span > Mary Greene </ p > < p >< span class = &quot;browser_label&quot; > PortfolioName: </ span > Wood Cuts </ p > < p >< span class = &quot;browser_label&quot; > PortfolioName: </ span > Oil Paintings </ p > </ div > </ body > </ html >
    • 9. Classic Problems
      • Slow
      • High bandwidth
      • Redundant
      • Page rendering
    • 10. Ajax Web Applications 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.  
    • 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? 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.0&quot; encoding = &quot;UTF-8&quot; ?> <! DOCTYPE struts PUBLIC &quot;-//Apache Software Foundation//DTD Struts Configuration 2.0//EN&quot; &quot;http://struts.apache.org/dtds/struts-2.0.dtd&quot; > < package name = &quot;chapterEightPublic&quot; namespace = &quot;/chapterEight&quot; extends = &quot;struts-default&quot; > < action name = &quot;ClassicUserBrowser&quot; class = &quot;manning.chapterEight.UserBrowser&quot; > < result > classicUserBrowser.jsp </ result > </ action > </ package > </ struts > < 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 Struts 2 – Second Generation Framework Struts 2 – Built on Software Engineering Principles Struts 2 – Fast Development, Flexible Architecture Ajax – No Page Rendering Ajax – Javascript Client Ajax – Lower Bandwidth Ajax – JSON, XML