SlideShare ist ein Scribd-Unternehmen logo
1 von 83
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Struts on Ajax:  Retrofitting Struts with Ajax Taglibs Tuesday, September 30th, 9a-10a Ted Husted
Struts on Ajax:  Retrofitting Struts with Ajax Taglibs Square One University Series
[object Object],[object Object],Struts on Ajax
Abstract ,[object Object],[object Object],[object Object],[object Object],[object Object]
Retrofitting Struts ,[object Object],[object Object],[object Object],[object Object],[object Object]
Retrofitting Struts ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Retrofitting Struts ,[object Object],[object Object],[object Object],[object Object],[object Object]
What is Ajax? ,[object Object],[object Object],[object Object],[object Object]
What was life like before Ajax? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How does Ajax work? ,[object Object],[object Object],[object Object],[object Object]
Can we use Ajax in a Struts app? ,[object Object],[object Object],[object Object],[object Object],[object Object]
public   class  IndexResult  extends  Action { public  ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)  throws  Exception { response.setContentType( "text/html" ); PrintWriter out = response.getWriter(); out.println( "Hello World! “ +  “ This is an AJAX response “ +  “ from a Struts Action." ); out.flush(); return   null ; } } actions.IndexResult.java
public   class  IndexResult2  extends ActionSupport { private  InputStream  inputStream ; public  InputStream getInputStream() { return   inputStream ; } public  String execute()  throws  Exception { inputStream =  new  StringBufferInputStream( "Hello World! This is an AJAX response " +  "from a Struts 2 Action." ); return   SUCCESS ; } } actions.IndexResult2.java
What are some pure Ajax Libraries? ,[object Object],[object Object]
http://www.prototypejs.org/
http://jquery.com/
What are some Ajax UI Libraries? ,[object Object],[object Object]
[object Object]
[object Object]
Are there Ajax JSP tag libraries? ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
Retrofitting Struts ,[object Object],[object Object],[object Object],[object Object],[object Object]
Why choose AjaxParts Taglib? ,[object Object],[object Object],[object Object],[object Object]
Why choose AjaxParts Taglib? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Retrofitting Struts ,[object Object],[object Object],[object Object],[object Object],[object Object]
How about a Simple Hello World Example? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How about a Simple Hello World Example? ,[object Object],[object Object],[object Object],[object Object],[object Object]
< html > < head > < title > Simple Hello World Example </ title > </ head > < body > < input  id = &quot;hello-button&quot;  type = &quot;button&quot;  value = &quot;Say Hello World via AJAX&quot;  /> < br  />< br  /> < div  id = &quot;hello-div&quot; ></ div > </ body > </ html > index.jsp
<%@  taglib  prefix = &quot;ajax&quot;  uri = &quot;javawebparts/ajaxparts/taglib&quot;  %> < html > < head > < title > Simple Hello World Example </ title > </ head > < body > < input  id = &quot;hello-button&quot;   type = &quot;button&quot;  value = &quot;Say Hello World via AJAX&quot;  /> < ajax:event  attachTo = &quot;hello-button&quot; ajaxRef = &quot;index/hello-button&quot; /> < br  />< br  /> < div  id = &quot;hello-div&quot; ></ div > < ajax:enable  /> </ body > </ html > index.jsp
ajax-config.xml < ajaxConfig > < group  ajaxRef = &quot;index&quot; > < element  ajaxRef = &quot;hello-button&quot; > < event  type = &quot;onclick&quot; > < requestHandler  type = &quot;std:SimpleRequest&quot; target = &quot; index-result.txt &quot; > < parameter  /> </ requestHandler > < responseHandler  type = &quot;std:InnerHTML&quot; > < parameter > hello-div </ parameter > </ responseHandler > </ event > </ element > </ group > </ ajaxConfig >
Hello World! I am an AJAX result from the (mock) server. index-result.txt
<web-app> <context-param> <param-name> AjaxPartsTaglibConfig </param-name> <param-value> /WEB-INF/ajax-config.xml </param-value>   </context-param> <context-param> <param-name> AjaxPartsTaglibValidateConfig </param-name> <param-value> false </param-value> </context-param> web.xml
What JARS do we need? ,[object Object],[object Object],[object Object]
 
 
Can we use a Struts action instead? ,[object Object]
public   class  IndexResult  extends  Action { public  ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)  throws  Exception { response.setContentType( &quot;text/html&quot; ); PrintWriter out = response.getWriter(); out.println( &quot;Hello World! “ +  “ This is an AJAX response “ +  “ from a Struts Action.&quot; ); out.flush(); return   null ; } } actions.IndexResult.java
< action path = &quot;/index-result&quot; type = &quot;actions.IndexResult&quot; validate = &quot;false&quot;  /> struts-config.xml
<requestHandler type=&quot;std:SimpleRequest&quot; target=&quot;index-result.txt&quot;>   < requestHandler  type = &quot;std:SimpleRequest&quot; target = &quot;/index-result.do&quot; >   ajax-config.xml
 
How about Struts 2? ,[object Object],[object Object],[object Object]
public   class  IndexResult2  extends ActionSupport { private  InputStream  inputStream ; public  InputStream getInputStream() { return   inputStream ; } public  String execute()  throws  Exception { inputStream =  new  StringBufferInputStream( &quot;Hello World! This is an AJAX response &quot; +  &quot;from a Struts 2 Action.&quot; ); return   SUCCESS ; } } actions.IndexResult2.java
< package  name = &quot;ajaxwebparts&quot;  extends = &quot;struts-default&quot; > < action  name = &quot;index-result&quot; class = &quot;actions.IndexResult2&quot; > < result  type = &quot;stream&quot; > < param  name = &quot;contentType&quot; > text/html </ param > < param  name = &quot;inputName&quot; > inputStream </ param > </ result > </ action > </ package > struts.xml
<requestHandler type=&quot;std:SimpleRequest&quot; target=&quot;/index-result.do&quot;>   < requestHandler  type = &quot;std:SimpleRequest&quot; target = &quot;/index-result.action&quot; >   ajax-config.xml
 
Is it really that easy? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Retrofitting Struts ,[object Object],[object Object],[object Object],[object Object],[object Object]
How does AjaxParts work? ,[object Object],[object Object],[object Object]
< ajaxConfig > < group  ajaxRef = &quot; index &quot; > < element  ajaxRef = &quot; hello-button &quot; > < event  type = &quot;onclick&quot; > < requestHandler  type = &quot;std:SimpleRequest&quot;  target = &quot; index-result.action &quot; > < parameter  /> How does AjaxParts work? <body> < input  id = &quot;hello-button&quot;   type = &quot;button&quot;  value = &quot;Say Hello World via AJAX&quot;  /> < ajax:event  attachTo = &quot;hello-button“ ajaxRef = &quot; index/hello-button &quot;  />
< responseHandler  type = &quot;std:InnerHTML&quot; > < parameter > hello-div </ parameter > </ responseHandler > < br  />< br  /> < div  id = &quot; hello-div &quot; ></ div > </ body > < ajax:enable  /> How does AjaxParts work?
What does <ajax:event> do? ,[object Object]
What does <ajax:event> do? < input  id = &quot;helloButton&quot;  type = &quot;button&quot;  value = &quot;Say Hello World via AJAX&quot;  /> < ajax:event    attachTo = &quot;helloButton&quot;    ajaxRef = &quot;index/hello-button&quot; /> ,[object Object]
What does <ajax:enable> do? ,[object Object],[object Object],[object Object]
What requestHandlers are there? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What requestHandlers are there? ,[object Object],[object Object],[object Object],[object Object]
What responseHandlers are there? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What responseHandlers are there? ,[object Object],[object Object],[object Object],[object Object]
What responseHandlers are there? ,[object Object],[object Object],[object Object],[object Object],[object Object]
What responseHandlers are there? ,[object Object],[object Object]
Is that all there is to AjaxParts? ,[object Object],[object Object],[object Object],[object Object],[object Object]
Is that all there is to AjaxParts? ,[object Object],[object Object],[object Object],[object Object],[object Object]
Is that all there is to AjaxParts? ,[object Object],[object Object],[object Object],[object Object]
Other Struts 1 Ajax Resources ,[object Object],[object Object],[object Object],[object Object]
Retrofitting Struts ,[object Object],[object Object],[object Object],[object Object],[object Object]
Are there new alternatives for Struts 2? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How do the S2 Ajax Tags work?  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How do the S2 Ajax Tags work?  ,[object Object],[object Object],[object Object],[object Object]
How do the S2 Ajax Tags work?  ,[object Object],[object Object],[object Object],[object Object]
 
 
 
<%@  taglib  prefix = &quot;yui&quot;  uri = &quot;/struts-yui-tags&quot;  %> <%@  taglib  prefix = &quot;s&quot;  uri = &quot;/struts-tags&quot;  %> < html > < head > < yui:head  datepicker = &quot;true&quot;  /> </ head > < body > < p > The selected date is    < s:property  value = &quot;datepicker&quot; /></ p > < s:form  action = &quot;datepicker&quot; > < yui:datepicker  id = &quot;datepicker&quot;   name = &quot;datepicker&quot; /> < s:submit  /> </ s:form >   </ body > </ html > datepicker.jsp
< action  name = &quot;datepicker&quot;  class = &quot;actions.Datepicker&quot; > < result > datepicker.jsp </ result > </ action > struts.xml
public   class  Datepicker  extends  ActionSupport { private  Date  datepicker ; public  Date getDatepicker() { return   datepicker ; } public   void  setDatepicker(Date value) { datepicker  = value; } } actions.DatePicker.java
 
Are there other Struts 2  Ajax resources?  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Is that all there is? ,[object Object],[object Object],[object Object],[object Object]
JSON-P support in APT ,[object Object],[object Object],[object Object],[object Object],[object Object]
Struts University Series

Weitere ähnliche Inhalte

Was ist angesagt?

Ajax Fundamentals Web Applications
Ajax Fundamentals Web ApplicationsAjax Fundamentals Web Applications
Ajax Fundamentals Web Applications
dominion
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
Tomek Kaczanowski
 

Was ist angesagt? (20)

Redux for ReactJS Programmers
Redux for ReactJS ProgrammersRedux for ReactJS Programmers
Redux for ReactJS Programmers
 
How to Add End-to-End Encryption to Your React App
How to Add End-to-End Encryption to Your React AppHow to Add End-to-End Encryption to Your React App
How to Add End-to-End Encryption to Your React App
 
ORM Injection
ORM InjectionORM Injection
ORM Injection
 
Introduction into Struts2 jQuery Grid Tags
Introduction into Struts2 jQuery Grid TagsIntroduction into Struts2 jQuery Grid Tags
Introduction into Struts2 jQuery Grid Tags
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Dom
 
Understanding Asynchronous JavaScript
Understanding Asynchronous JavaScriptUnderstanding Asynchronous JavaScript
Understanding Asynchronous JavaScript
 
Building Advanced XSS Vectors
Building Advanced XSS VectorsBuilding Advanced XSS Vectors
Building Advanced XSS Vectors
 
JavaScript Best Pratices
JavaScript Best PraticesJavaScript Best Pratices
JavaScript Best Pratices
 
GKAC 2015 Apr. - RxAndroid
GKAC 2015 Apr. - RxAndroidGKAC 2015 Apr. - RxAndroid
GKAC 2015 Apr. - RxAndroid
 
Reactive, component 그리고 angular2
Reactive, component 그리고  angular2Reactive, component 그리고  angular2
Reactive, component 그리고 angular2
 
Developing web-apps like it's 2013
Developing web-apps like it's 2013Developing web-apps like it's 2013
Developing web-apps like it's 2013
 
Understanding Object Oriented Javascript - Coffee@DBG June
Understanding Object Oriented Javascript - Coffee@DBG JuneUnderstanding Object Oriented Javascript - Coffee@DBG June
Understanding Object Oriented Javascript - Coffee@DBG June
 
Ajax Performance
Ajax PerformanceAjax Performance
Ajax Performance
 
Ajax Fundamentals Web Applications
Ajax Fundamentals Web ApplicationsAjax Fundamentals Web Applications
Ajax Fundamentals Web Applications
 
Server1
Server1Server1
Server1
 
Workshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideWorkshop 26: React Native - The Native Side
Workshop 26: React Native - The Native Side
 
Demystifying dependency Injection: Dagger and Toothpick
Demystifying dependency Injection: Dagger and ToothpickDemystifying dependency Injection: Dagger and Toothpick
Demystifying dependency Injection: Dagger and Toothpick
 
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolbox
 
Selectors and normalizing state shape
Selectors and normalizing state shapeSelectors and normalizing state shape
Selectors and normalizing state shape
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
 

Andere mochten auch

Andere mochten auch (6)

seismic retrofitting using precast elements
seismic retrofitting using precast elementsseismic retrofitting using precast elements
seismic retrofitting using precast elements
 
Considerations for Seismic Retrofitting
Considerations for Seismic RetrofittingConsiderations for Seismic Retrofitting
Considerations for Seismic Retrofitting
 
Seismic retrofitting techniques of rcc
Seismic retrofitting techniques of rccSeismic retrofitting techniques of rcc
Seismic retrofitting techniques of rcc
 
Repair and Retrofit on Beam and Column Joints
Repair and Retrofit on Beam and Column JointsRepair and Retrofit on Beam and Column Joints
Repair and Retrofit on Beam and Column Joints
 
Canal irrigation
Canal irrigationCanal irrigation
Canal irrigation
 
Seismic Retrofitting Techniques
Seismic Retrofitting TechniquesSeismic Retrofitting Techniques
Seismic Retrofitting Techniques
 

Ähnlich wie Retrofitting

Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
Sagar Nakul
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
Carles Farré
 

Ähnlich wie Retrofitting (20)

Struts2
Struts2Struts2
Struts2
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 
Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2
 
Ajax
AjaxAjax
Ajax
 
What's Coming in Spring 3.0
What's Coming in Spring 3.0What's Coming in Spring 3.0
What's Coming in Spring 3.0
 
AJAX Workshop Notes
AJAX Workshop NotesAJAX Workshop Notes
AJAX Workshop Notes
 
Ajax Ppt
Ajax PptAjax Ppt
Ajax Ppt
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
J Query Presentation
J Query PresentationJ Query Presentation
J Query Presentation
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
 
Jquery 1
Jquery 1Jquery 1
Jquery 1
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
 
Introduction to JQuery
Introduction to JQueryIntroduction to JQuery
Introduction to JQuery
 
Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2
 

Mehr von Ted Husted

Open Source Secret Sauce - Lugor Sep 2011
Open Source Secret Sauce - Lugor Sep 2011Open Source Secret Sauce - Lugor Sep 2011
Open Source Secret Sauce - Lugor Sep 2011
Ted Husted
 
Open source secret_sauce_apache_con_2010
Open source secret_sauce_apache_con_2010Open source secret_sauce_apache_con_2010
Open source secret_sauce_apache_con_2010
Ted Husted
 
Drupal kickstart-workshop
Drupal kickstart-workshopDrupal kickstart-workshop
Drupal kickstart-workshop
Ted Husted
 

Mehr von Ted Husted (17)

Ship It!
Ship It!Ship It!
Ship It!
 
.NET @ apache.org
 .NET @ apache.org .NET @ apache.org
.NET @ apache.org
 
The secret life_of_open_source
The secret life_of_open_sourceThe secret life_of_open_source
The secret life_of_open_source
 
Open Source Secret Sauce - Lugor Sep 2011
Open Source Secret Sauce - Lugor Sep 2011Open Source Secret Sauce - Lugor Sep 2011
Open Source Secret Sauce - Lugor Sep 2011
 
NU FaceBook 101 JCC 2010
NU  FaceBook 101 JCC 2010NU  FaceBook 101 JCC 2010
NU FaceBook 101 JCC 2010
 
Developing java Web Applications Using Google Apps RJUG 2011
Developing java Web Applications Using Google Apps RJUG 2011Developing java Web Applications Using Google Apps RJUG 2011
Developing java Web Applications Using Google Apps RJUG 2011
 
Open source secret_sauce_apache_con_2010
Open source secret_sauce_apache_con_2010Open source secret_sauce_apache_con_2010
Open source secret_sauce_apache_con_2010
 
Drupal kickstart-workshop
Drupal kickstart-workshopDrupal kickstart-workshop
Drupal kickstart-workshop
 
Open source-secret-sauce-rit-2010
Open source-secret-sauce-rit-2010Open source-secret-sauce-rit-2010
Open source-secret-sauce-rit-2010
 
Agile Analysis with Use Cases: Balancing Utility with Simplicity
Agile Analysis with Use Cases: Balancing Utility with SimplicityAgile Analysis with Use Cases: Balancing Utility with Simplicity
Agile Analysis with Use Cases: Balancing Utility with Simplicity
 
Testing Web Application Security
Testing Web Application SecurityTesting Web Application Security
Testing Web Application Security
 
API Doc Smackdown
API Doc SmackdownAPI Doc Smackdown
API Doc Smackdown
 
Testing The Testers
Testing The TestersTesting The Testers
Testing The Testers
 
Testing Ajax Applications
Testing Ajax ApplicationsTesting Ajax Applications
Testing Ajax Applications
 
Testing Ajax Web Applications
Testing Ajax Web ApplicationsTesting Ajax Web Applications
Testing Ajax Web Applications
 
Testing Tools
Testing ToolsTesting Tools
Testing Tools
 
Open Source Secret Sauce
Open Source Secret SauceOpen Source Secret Sauce
Open Source Secret Sauce
 

Kürzlich hochgeladen

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
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
panagenda
 
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
Safe Software
 
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
Safe Software
 
+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@
 

Kürzlich hochgeladen (20)

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
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
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...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
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
 
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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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
 
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
 
+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...
 
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
 

Retrofitting

  • 1.
  • 2. Struts on Ajax: Retrofitting Struts with Ajax Taglibs Square One University Series
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. public class IndexResult extends Action { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { response.setContentType( &quot;text/html&quot; ); PrintWriter out = response.getWriter(); out.println( &quot;Hello World! “ + “ This is an AJAX response “ + “ from a Struts Action.&quot; ); out.flush(); return null ; } } actions.IndexResult.java
  • 13. public class IndexResult2 extends ActionSupport { private InputStream inputStream ; public InputStream getInputStream() { return inputStream ; } public String execute() throws Exception { inputStream = new StringBufferInputStream( &quot;Hello World! This is an AJAX response &quot; + &quot;from a Struts 2 Action.&quot; ); return SUCCESS ; } } actions.IndexResult2.java
  • 14.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. < html > < head > < title > Simple Hello World Example </ title > </ head > < body > < input id = &quot;hello-button&quot; type = &quot;button&quot; value = &quot;Say Hello World via AJAX&quot; /> < br />< br /> < div id = &quot;hello-div&quot; ></ div > </ body > </ html > index.jsp
  • 33. <%@ taglib prefix = &quot;ajax&quot; uri = &quot;javawebparts/ajaxparts/taglib&quot; %> < html > < head > < title > Simple Hello World Example </ title > </ head > < body > < input id = &quot;hello-button&quot; type = &quot;button&quot; value = &quot;Say Hello World via AJAX&quot; /> < ajax:event attachTo = &quot;hello-button&quot; ajaxRef = &quot;index/hello-button&quot; /> < br />< br /> < div id = &quot;hello-div&quot; ></ div > < ajax:enable /> </ body > </ html > index.jsp
  • 34. ajax-config.xml < ajaxConfig > < group ajaxRef = &quot;index&quot; > < element ajaxRef = &quot;hello-button&quot; > < event type = &quot;onclick&quot; > < requestHandler type = &quot;std:SimpleRequest&quot; target = &quot; index-result.txt &quot; > < parameter /> </ requestHandler > < responseHandler type = &quot;std:InnerHTML&quot; > < parameter > hello-div </ parameter > </ responseHandler > </ event > </ element > </ group > </ ajaxConfig >
  • 35. Hello World! I am an AJAX result from the (mock) server. index-result.txt
  • 36. <web-app> <context-param> <param-name> AjaxPartsTaglibConfig </param-name> <param-value> /WEB-INF/ajax-config.xml </param-value> </context-param> <context-param> <param-name> AjaxPartsTaglibValidateConfig </param-name> <param-value> false </param-value> </context-param> web.xml
  • 37.
  • 38.  
  • 39.  
  • 40.
  • 41. public class IndexResult extends Action { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { response.setContentType( &quot;text/html&quot; ); PrintWriter out = response.getWriter(); out.println( &quot;Hello World! “ + “ This is an AJAX response “ + “ from a Struts Action.&quot; ); out.flush(); return null ; } } actions.IndexResult.java
  • 42. < action path = &quot;/index-result&quot; type = &quot;actions.IndexResult&quot; validate = &quot;false&quot; /> struts-config.xml
  • 43. <requestHandler type=&quot;std:SimpleRequest&quot; target=&quot;index-result.txt&quot;> < requestHandler type = &quot;std:SimpleRequest&quot; target = &quot;/index-result.do&quot; > ajax-config.xml
  • 44.  
  • 45.
  • 46. public class IndexResult2 extends ActionSupport { private InputStream inputStream ; public InputStream getInputStream() { return inputStream ; } public String execute() throws Exception { inputStream = new StringBufferInputStream( &quot;Hello World! This is an AJAX response &quot; + &quot;from a Struts 2 Action.&quot; ); return SUCCESS ; } } actions.IndexResult2.java
  • 47. < package name = &quot;ajaxwebparts&quot; extends = &quot;struts-default&quot; > < action name = &quot;index-result&quot; class = &quot;actions.IndexResult2&quot; > < result type = &quot;stream&quot; > < param name = &quot;contentType&quot; > text/html </ param > < param name = &quot;inputName&quot; > inputStream </ param > </ result > </ action > </ package > struts.xml
  • 48. <requestHandler type=&quot;std:SimpleRequest&quot; target=&quot;/index-result.do&quot;> < requestHandler type = &quot;std:SimpleRequest&quot; target = &quot;/index-result.action&quot; > ajax-config.xml
  • 49.  
  • 50.
  • 51.
  • 52.
  • 53. < ajaxConfig > < group ajaxRef = &quot; index &quot; > < element ajaxRef = &quot; hello-button &quot; > < event type = &quot;onclick&quot; > < requestHandler type = &quot;std:SimpleRequest&quot; target = &quot; index-result.action &quot; > < parameter /> How does AjaxParts work? <body> < input id = &quot;hello-button&quot; type = &quot;button&quot; value = &quot;Say Hello World via AJAX&quot; /> < ajax:event attachTo = &quot;hello-button“ ajaxRef = &quot; index/hello-button &quot; />
  • 54. < responseHandler type = &quot;std:InnerHTML&quot; > < parameter > hello-div </ parameter > </ responseHandler > < br />< br /> < div id = &quot; hello-div &quot; ></ div > </ body > < ajax:enable /> How does AjaxParts work?
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.  
  • 74.  
  • 75.  
  • 76. <%@ taglib prefix = &quot;yui&quot; uri = &quot;/struts-yui-tags&quot; %> <%@ taglib prefix = &quot;s&quot; uri = &quot;/struts-tags&quot; %> < html > < head > < yui:head datepicker = &quot;true&quot; /> </ head > < body > < p > The selected date is < s:property value = &quot;datepicker&quot; /></ p > < s:form action = &quot;datepicker&quot; > < yui:datepicker id = &quot;datepicker&quot; name = &quot;datepicker&quot; /> < s:submit /> </ s:form > </ body > </ html > datepicker.jsp
  • 77. < action name = &quot;datepicker&quot; class = &quot;actions.Datepicker&quot; > < result > datepicker.jsp </ result > </ action > struts.xml
  • 78. public class Datepicker extends ActionSupport { private Date datepicker ; public Date getDatepicker() { return datepicker ; } public void setDatepicker(Date value) { datepicker = value; } } actions.DatePicker.java
  • 79.  
  • 80.
  • 81.
  • 82.