SlideShare una empresa de Scribd logo
1 de 25
Introducing Struts 2 JaMU 07.02 – February 24, 2007 Thomas Wiradikusuma (thomas@wiradikusuma.com) Java User Group Indonesia
Struts 2 defined ,[object Object],[object Object],[object Object],[object Object]
Sweet spots ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Architecture ,[object Object],[object Object],[object Object],[object Object],[object Object]
Architecture, cont’d
ActionMapper ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Interceptors <interceptor-stack name=&quot;xaStack&quot;> <interceptor-ref name=&quot;thisWillRunFirstInterceptor&quot;/> <interceptor-ref name=&quot;thisWillRunNextInterceptor&quot;/> <interceptor-ref name=&quot;followedByThisInterceptor&quot;/> <interceptor-ref name=&quot;thisWillRunLastInterceptor&quot;/> </interceptor-stack> thisWillRunFirstInterceptor thisWillRunNextInterceptor followedByThisInterceptor thisWillRunLastInterceptor MyAction1 MyAction2 (chain) MyPreResultListener MyResult (result) thisWillRunLastInterceptor followedByThisInterceptor thisWillRunNextInterceptor thisWillRunFirstInterceptor
Interceptors, cont’d Checks for valid token presence in Action, prevents duplicate form submission. token  Token And many more… Action will only be executed if the user has the correct JAAS role. roles  Roles If the Action implements Preparable, calls its prepare method.  prepare  Prepare Sets the request parameters onto the Action.  params  Parameters Executes the Action in the background and then sends the user off to an intermediate waiting page.  execAndWait  Execute and Wait Adds automatic checkbox handling code that detect an unchecked checkbox and add it as a parameter with a default (usually 'false') value. Uses a specially named hidden field to detect unsubmitted checkboxes.  checkbox  Checkbox Description Name Interceptor
Actions ,[object Object],[object Object]
Results Used for Velocity integration Velocity And many more… Used for Action Chaining Chain Used to stream an InputStream back to the browser (usually for file downloads) Stream Used to redirect to another action mapping Redirect Action Used to redirect to another URL (web resource)  Redirect Used for web resource integration, including JSP integration Dispatcher Usage Result
Type conversion ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Localization ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Configuration files Override the default Velocity configuration /WEB-INF/classes/  Yes velocity.properties Optional configuration files for plug-ins in the same format as struts.xml. Root of a plug-in JAR  Yes struts-plugin.xml  Default macros referenced by velocity.properties /WEB-INF/classes/  Yes struts-default.vm Default configuration provided by Struts /WEB-INF/lib/struts2-core.jar  Yes struts-default.xml Framework properties /WEB-INF/classes/  Yes struts.properties Main configuration, contains result/view types, action mappings, interceptors, and so forth /WEB-INF/classes/  Yes struts.xml Deployment descriptor /WEB-INF/  No web.xml Purpose  Location Optional? File
Taglib <% User user = ActionContext.getContext() %> <form action=&quot;Profile_update.action&quot; method=&quot;post&quot;> <table> <tr> <td> align=&quot;right&quot;><label>First name:</label></td> <td><input type=&quot;text&quot; name=&quot;user.firstname&quot; value=&quot;<%=user.getFirstname() %> /></td> </tr> <tr> <td> <input type=&quot;radio&quot; name=&quot;user.gender&quot; value=&quot;0&quot; id=&quot;user.gender0&quot;  <% if (user.getGender()==0) { %> checked=&quot;checked&quot; %> } %> /> <label for=&quot;user.gender0&quot;>Female</label> ... Without taglib (JSP): <s:actionerror/> <s:form action=&quot;Profile_update&quot; validate=&quot;true&quot;> <s:textfield label=&quot;Username&quot; name=&quot;username&quot;/> <s:password label=&quot;Password&quot; name=&quot;password&quot;/> <s:password label=&quot;(Repeat) Password&quot; name=&quot;password2&quot;/> <s:textfield label=&quot;Full Name&quot; name=&quot;fullName&quot;/> <s:textfield label=&quot;From Address&quot; name=&quot;fromAddress&quot;/> <s:textfield label=&quot;Reply To Address&quot; name=&quot;replyToAddress&quot;/> <s:submit value=&quot;Save&quot; name=&quot;Save&quot;/> <s:submit action=&quot;Register_cancel&quot; value=&quot;Cancel&quot; name=&quot;Cancel&quot; onclick=&quot;form.onsubmit=null&quot;/> </s:form> With taglib (JSP):
Taglib, cont’d ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Servlet/JSP scoped object ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
OGNL ,[object Object],[object Object]
Spring integration ,[object Object]
Testing ,[object Object],[object Object],[object Object]
Struts 1 to Struts 2 Despite the similar name (Struts), migrating from Struts 1 is harder than migrating from WebWork 2. struts.xml struts-config.xml Action or POJO ActionForm Action or POJO Action (singleton) {action}-validation.xml validation.xml Result ActionForward Interceptors RequestProcessor FilterDispatcher ActionServlet Struts 2 Struts 1
WebWork 2 to Struts 2 Pretty much the same, only naming/namespace changes. <s:*/> <ww:*/> struts.xml xwork.xml struts.properties webwork.properties com.opensymphony.xwork2.* com.opensymphony.xwork.* “ struts” “ webwork” org.apache.struts2.* com.opensymphony.webwork.* Struts 2 WebWork 2
Requirements ,[object Object],[object Object],[object Object]
Integration with open source libraries ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Not discussed ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Where to go from here ,[object Object],[object Object],[object Object],[object Object]

Más contenido relacionado

La actualidad más candente

01 introduction to struts2
01 introduction to struts201 introduction to struts2
01 introduction to struts2Smita B Kumar
 
Struts2
Struts2Struts2
Struts2yuvalb
 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Applicationelliando dias
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applicationselliando dias
 
Struts2 course chapter 1: Evolution of Web Applications
Struts2 course chapter 1: Evolution of Web ApplicationsStruts2 course chapter 1: Evolution of Web Applications
Struts2 course chapter 1: Evolution of Web ApplicationsJavaEE Trainers
 
Struts Introduction Course
Struts Introduction CourseStruts Introduction Course
Struts Introduction Courseguest764934
 

La actualidad más candente (20)

Struts Ppt 1
Struts Ppt 1Struts Ppt 1
Struts Ppt 1
 
Struts2 notes
Struts2 notesStruts2 notes
Struts2 notes
 
Struts 1
Struts 1Struts 1
Struts 1
 
01 introduction to struts2
01 introduction to struts201 introduction to struts2
01 introduction to struts2
 
Struts Basics
Struts BasicsStruts Basics
Struts Basics
 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
 
Struts2
Struts2Struts2
Struts2
 
Struts ppt 1
Struts ppt 1Struts ppt 1
Struts ppt 1
 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Application
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applications
 
Struts
StrutsStruts
Struts
 
Struts course material
Struts course materialStruts course material
Struts course material
 
Skillwise Struts.x
Skillwise Struts.xSkillwise Struts.x
Skillwise Struts.x
 
Struts2 course chapter 1: Evolution of Web Applications
Struts2 course chapter 1: Evolution of Web ApplicationsStruts2 course chapter 1: Evolution of Web Applications
Struts2 course chapter 1: Evolution of Web Applications
 
Struts
StrutsStruts
Struts
 
TY.BSc.IT Java QB U1
TY.BSc.IT Java QB U1TY.BSc.IT Java QB U1
TY.BSc.IT Java QB U1
 
TY.BSc.IT Java QB U6
TY.BSc.IT Java QB U6TY.BSc.IT Java QB U6
TY.BSc.IT Java QB U6
 
Struts Introduction Course
Struts Introduction CourseStruts Introduction Course
Struts Introduction Course
 
TY.BSc.IT Java QB U3
TY.BSc.IT Java QB U3TY.BSc.IT Java QB U3
TY.BSc.IT Java QB U3
 
Struts notes
Struts notesStruts notes
Struts notes
 

Destacado

ERP Implementation: Avoiding Common Pitfalls
ERP Implementation: Avoiding Common PitfallsERP Implementation: Avoiding Common Pitfalls
ERP Implementation: Avoiding Common PitfallsKirill Popadyuk
 
Rapid Deployment of ERP solutions using Lean & Agile Methods
Rapid Deployment of ERP solutions using Lean & Agile MethodsRapid Deployment of ERP solutions using Lean & Agile Methods
Rapid Deployment of ERP solutions using Lean & Agile MethodsHusni Roukbi
 
Top 10 Reasons to Choose Oracle ERP Cloud Financials
Top 10 Reasons to Choose Oracle ERP Cloud FinancialsTop 10 Reasons to Choose Oracle ERP Cloud Financials
Top 10 Reasons to Choose Oracle ERP Cloud FinancialsLiz Kensicki
 
12. Managing Risk Factors In Erp Implementation And Design
12. Managing Risk Factors In Erp Implementation And Design12. Managing Risk Factors In Erp Implementation And Design
12. Managing Risk Factors In Erp Implementation And DesignDonovan Mulder
 
Hidden cost of erp customization
Hidden cost of erp customizationHidden cost of erp customization
Hidden cost of erp customizationDrake Brown
 
Risk In Erp Implementation Projects
Risk In Erp Implementation ProjectsRisk In Erp Implementation Projects
Risk In Erp Implementation ProjectsAmarnath Gupta
 
ERP-Case Study- Changes before and after implementing ERP in a company
ERP-Case Study- Changes before and after implementing ERP in a companyERP-Case Study- Changes before and after implementing ERP in a company
ERP-Case Study- Changes before and after implementing ERP in a companyAniket Maithani
 
Air India - ERP Implementation Case Study
Air India - ERP Implementation Case StudyAir India - ERP Implementation Case Study
Air India - ERP Implementation Case StudyArgha Ray
 
Implementing Cloud Financials
Implementing Cloud FinancialsImplementing Cloud Financials
Implementing Cloud FinancialsNERUG
 

Destacado (10)

ERP Implementation: Avoiding Common Pitfalls
ERP Implementation: Avoiding Common PitfallsERP Implementation: Avoiding Common Pitfalls
ERP Implementation: Avoiding Common Pitfalls
 
Rapid Deployment of ERP solutions using Lean & Agile Methods
Rapid Deployment of ERP solutions using Lean & Agile MethodsRapid Deployment of ERP solutions using Lean & Agile Methods
Rapid Deployment of ERP solutions using Lean & Agile Methods
 
Top 10 Reasons to Choose Oracle ERP Cloud Financials
Top 10 Reasons to Choose Oracle ERP Cloud FinancialsTop 10 Reasons to Choose Oracle ERP Cloud Financials
Top 10 Reasons to Choose Oracle ERP Cloud Financials
 
12. Managing Risk Factors In Erp Implementation And Design
12. Managing Risk Factors In Erp Implementation And Design12. Managing Risk Factors In Erp Implementation And Design
12. Managing Risk Factors In Erp Implementation And Design
 
Hidden cost of erp customization
Hidden cost of erp customizationHidden cost of erp customization
Hidden cost of erp customization
 
Lesson Learned Report
Lesson Learned ReportLesson Learned Report
Lesson Learned Report
 
Risk In Erp Implementation Projects
Risk In Erp Implementation ProjectsRisk In Erp Implementation Projects
Risk In Erp Implementation Projects
 
ERP-Case Study- Changes before and after implementing ERP in a company
ERP-Case Study- Changes before and after implementing ERP in a companyERP-Case Study- Changes before and after implementing ERP in a company
ERP-Case Study- Changes before and after implementing ERP in a company
 
Air India - ERP Implementation Case Study
Air India - ERP Implementation Case StudyAir India - ERP Implementation Case Study
Air India - ERP Implementation Case Study
 
Implementing Cloud Financials
Implementing Cloud FinancialsImplementing Cloud Financials
Implementing Cloud Financials
 

Similar a 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 Presentationipolevoy
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalystdwm042
 
AJAX Workshop Notes
AJAX Workshop NotesAJAX Workshop Notes
AJAX Workshop NotesPamela Fox
 
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 2Matt Raible
 
Krazykoder struts2 interceptors
Krazykoder struts2 interceptorsKrazykoder struts2 interceptors
Krazykoder struts2 interceptorsKrazy Koder
 
[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é
 
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.0Matt Raible
 
Internet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian ThilmanyInternet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian ThilmanyChristian Thilmany
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVCRichard Paul
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSFSoftServe
 

Similar a Introducing Struts 2 (20)

Retrofitting
RetrofittingRetrofitting
Retrofitting
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
AJAX Workshop Notes
AJAX Workshop NotesAJAX Workshop Notes
AJAX Workshop Notes
 
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
 
Struts2.0basic
Struts2.0basicStruts2.0basic
Struts2.0basic
 
Krazykoder struts2 interceptors
Krazykoder struts2 interceptorsKrazykoder struts2 interceptors
Krazykoder struts2 interceptors
 
Android best practices
Android best practicesAndroid best practices
Android best practices
 
Spine.js
Spine.jsSpine.js
Spine.js
 
[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)
 
Spring Surf 101
Spring Surf 101Spring Surf 101
Spring Surf 101
 
Struts Overview
Struts OverviewStruts Overview
Struts Overview
 
Jsfsunum
JsfsunumJsfsunum
Jsfsunum
 
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
 
Internet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian ThilmanyInternet Explorer 8 for Developers by Christian Thilmany
Internet Explorer 8 for Developers by Christian Thilmany
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVC
 
Struts2 - 101
Struts2 - 101Struts2 - 101
Struts2 - 101
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 
Struts2 in a nutshell
Struts2 in a nutshellStruts2 in a nutshell
Struts2 in a nutshell
 
Jsp
JspJsp
Jsp
 

Más de wiradikusuma

Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Javawiradikusuma
 
Open Source And Java
Open Source And JavaOpen Source And Java
Open Source And Javawiradikusuma
 
Open Source is Not An Alternative, It is The Solution
Open Source is Not An Alternative, It is The SolutionOpen Source is Not An Alternative, It is The Solution
Open Source is Not An Alternative, It is The Solutionwiradikusuma
 
Spring 2.1 Exposed
Spring 2.1 ExposedSpring 2.1 Exposed
Spring 2.1 Exposedwiradikusuma
 
A Taste of Java ME
A Taste of Java MEA Taste of Java ME
A Taste of Java MEwiradikusuma
 

Más de wiradikusuma (9)

Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Java
 
Open Source And Java
Open Source And JavaOpen Source And Java
Open Source And Java
 
Open Source is Not An Alternative, It is The Solution
Open Source is Not An Alternative, It is The SolutionOpen Source is Not An Alternative, It is The Solution
Open Source is Not An Alternative, It is The Solution
 
Design Pattern
Design PatternDesign Pattern
Design Pattern
 
Spring 2.1 Exposed
Spring 2.1 ExposedSpring 2.1 Exposed
Spring 2.1 Exposed
 
A Taste of Java ME
A Taste of Java MEA Taste of Java ME
A Taste of Java ME
 
Subversion
SubversionSubversion
Subversion
 
Spring and DWR
Spring and DWRSpring and DWR
Spring and DWR
 
OOP in Java
OOP in JavaOOP in Java
OOP in Java
 

Último

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 

Último (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 

Introducing Struts 2

  • 1. Introducing Struts 2 JaMU 07.02 – February 24, 2007 Thomas Wiradikusuma (thomas@wiradikusuma.com) Java User Group Indonesia
  • 2.
  • 3.
  • 4.
  • 6.
  • 7. Interceptors <interceptor-stack name=&quot;xaStack&quot;> <interceptor-ref name=&quot;thisWillRunFirstInterceptor&quot;/> <interceptor-ref name=&quot;thisWillRunNextInterceptor&quot;/> <interceptor-ref name=&quot;followedByThisInterceptor&quot;/> <interceptor-ref name=&quot;thisWillRunLastInterceptor&quot;/> </interceptor-stack> thisWillRunFirstInterceptor thisWillRunNextInterceptor followedByThisInterceptor thisWillRunLastInterceptor MyAction1 MyAction2 (chain) MyPreResultListener MyResult (result) thisWillRunLastInterceptor followedByThisInterceptor thisWillRunNextInterceptor thisWillRunFirstInterceptor
  • 8. Interceptors, cont’d Checks for valid token presence in Action, prevents duplicate form submission. token Token And many more… Action will only be executed if the user has the correct JAAS role. roles Roles If the Action implements Preparable, calls its prepare method. prepare Prepare Sets the request parameters onto the Action. params Parameters Executes the Action in the background and then sends the user off to an intermediate waiting page. execAndWait Execute and Wait Adds automatic checkbox handling code that detect an unchecked checkbox and add it as a parameter with a default (usually 'false') value. Uses a specially named hidden field to detect unsubmitted checkboxes. checkbox Checkbox Description Name Interceptor
  • 9.
  • 10. Results Used for Velocity integration Velocity And many more… Used for Action Chaining Chain Used to stream an InputStream back to the browser (usually for file downloads) Stream Used to redirect to another action mapping Redirect Action Used to redirect to another URL (web resource) Redirect Used for web resource integration, including JSP integration Dispatcher Usage Result
  • 11.
  • 12.
  • 13. Configuration files Override the default Velocity configuration /WEB-INF/classes/ Yes velocity.properties Optional configuration files for plug-ins in the same format as struts.xml. Root of a plug-in JAR Yes struts-plugin.xml Default macros referenced by velocity.properties /WEB-INF/classes/ Yes struts-default.vm Default configuration provided by Struts /WEB-INF/lib/struts2-core.jar Yes struts-default.xml Framework properties /WEB-INF/classes/ Yes struts.properties Main configuration, contains result/view types, action mappings, interceptors, and so forth /WEB-INF/classes/ Yes struts.xml Deployment descriptor /WEB-INF/ No web.xml Purpose Location Optional? File
  • 14. Taglib <% User user = ActionContext.getContext() %> <form action=&quot;Profile_update.action&quot; method=&quot;post&quot;> <table> <tr> <td> align=&quot;right&quot;><label>First name:</label></td> <td><input type=&quot;text&quot; name=&quot;user.firstname&quot; value=&quot;<%=user.getFirstname() %> /></td> </tr> <tr> <td> <input type=&quot;radio&quot; name=&quot;user.gender&quot; value=&quot;0&quot; id=&quot;user.gender0&quot; <% if (user.getGender()==0) { %> checked=&quot;checked&quot; %> } %> /> <label for=&quot;user.gender0&quot;>Female</label> ... Without taglib (JSP): <s:actionerror/> <s:form action=&quot;Profile_update&quot; validate=&quot;true&quot;> <s:textfield label=&quot;Username&quot; name=&quot;username&quot;/> <s:password label=&quot;Password&quot; name=&quot;password&quot;/> <s:password label=&quot;(Repeat) Password&quot; name=&quot;password2&quot;/> <s:textfield label=&quot;Full Name&quot; name=&quot;fullName&quot;/> <s:textfield label=&quot;From Address&quot; name=&quot;fromAddress&quot;/> <s:textfield label=&quot;Reply To Address&quot; name=&quot;replyToAddress&quot;/> <s:submit value=&quot;Save&quot; name=&quot;Save&quot;/> <s:submit action=&quot;Register_cancel&quot; value=&quot;Cancel&quot; name=&quot;Cancel&quot; onclick=&quot;form.onsubmit=null&quot;/> </s:form> With taglib (JSP):
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20. Struts 1 to Struts 2 Despite the similar name (Struts), migrating from Struts 1 is harder than migrating from WebWork 2. struts.xml struts-config.xml Action or POJO ActionForm Action or POJO Action (singleton) {action}-validation.xml validation.xml Result ActionForward Interceptors RequestProcessor FilterDispatcher ActionServlet Struts 2 Struts 1
  • 21. WebWork 2 to Struts 2 Pretty much the same, only naming/namespace changes. <s:*/> <ww:*/> struts.xml xwork.xml struts.properties webwork.properties com.opensymphony.xwork2.* com.opensymphony.xwork.* “ struts” “ webwork” org.apache.struts2.* com.opensymphony.webwork.* Struts 2 WebWork 2
  • 22.
  • 23.
  • 24.
  • 25.