SlideShare a Scribd company logo
Module 7: Struts 2 Basics


  Thanisa Kruawaisayawan
   Thanachart Numnonda
   www.imcinstitute.com
Apache Struts
   Struts is an open source Web application framework
    developed as Apache Jakarta project
     http://jakarta.apache.org/struts/
   Model-View-Controller (MVC) framework
   Used for constructing web applications based Servlets
    and JSP technologies
     Strutsapplication is a genuine Web application that should
      be able to run on any Servlet container including all Java
      EE compliant App servers


                                                                   2
Why Struts?
 Takes much of the complexity out of building your
  own MVC framework
 Encourages good design practice and modeling
 Easy to learn and use
 Feature-rich and many supported 3rd-party tools
 Flexible and extensible
 Large user community
 Stable and mature
 Open source                                       3
How Struts 2 Works




                     4
Our Goal




           5
Steps
1. Write JSP pages (View)
2. Write Action class (Model)
3. Forward at either success or error
   through configuration set in struts.xml
4. Build, deploy, and test the application




                                             6
Step 1: Write JSP pages



                          7
JSP Pages
 Write one JSP page for each view
 Use Struts tags for
     Handing  HTML input forms
     Writing out messages




                                     8
login.jsp




            9
welcome.jsp




              10
Step 2: Write
Action classes



                 11
Action Class
Extend com.opensymphony.xwork2.ActionSupport
  class
 Decide set of properties that reflect the input form
 Write getter and setter methods for each property
 Write execute() method




                                                         12
LoginAction.java




                   13
Step 3: Config
  struts.xml



                 14
struts.xml
   Identify required Action's and then define them as
    <action> elements




                                                         15
Step 5: Build, Deploy,
and Test Application


                         16
Results




          17
Acknowledgement
 Most contents are borrowed from the
presentation slides of Sang Shin, Java™
Technology Evangelist, Sun Microsystems,
Inc.




                                           18
Thank you

   thananum@gmail.com
www.facebook.com/imcinstitute
   www.imcinstitute.com



                                19

More Related Content

What's hot (20)

PDF
Jsf intro
vantinhkhuc
 
PPTX
Introduction to jsf 2
yousry ibrahim
 
PPT
Struts,Jsp,Servlet
dasguptahirak
 
PPT
Struts course material
Vibrant Technologies & Computers
 
DOCX
TY.BSc.IT Java QB U4
Lokesh Singrol
 
PPT
Java Server Faces (JSF) - Basics
BG Java EE Course
 
PDF
JSP Technology I
People Strategists
 
PPT
Jsp ppt
Vikas Jagtap
 
DOCX
TY.BSc.IT Java QB U3
Lokesh Singrol
 
PDF
Lecture 10 - Java Server Faces (JSF)
Fahad Golra
 
ODP
A Complete Tour of JSF 2
Jim Driscoll
 
PPT
JSF basics
airbo
 
PPT
JSF Component Behaviors
Andy Schwartz
 
DOCX
TY.BSc.IT Java QB U5&6
Lokesh Singrol
 
PPT
Struts Introduction Course
guest764934
 
ODP
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
PPT
Java EE Introduction
ejlp12
 
PPSX
Spring - Part 4 - Spring MVC
Hitesh-Java
 
PPT
Jsf2.0 -4
Vinay Kumar
 
Jsf intro
vantinhkhuc
 
Introduction to jsf 2
yousry ibrahim
 
Struts,Jsp,Servlet
dasguptahirak
 
Struts course material
Vibrant Technologies & Computers
 
TY.BSc.IT Java QB U4
Lokesh Singrol
 
Java Server Faces (JSF) - Basics
BG Java EE Course
 
JSP Technology I
People Strategists
 
Jsp ppt
Vikas Jagtap
 
TY.BSc.IT Java QB U3
Lokesh Singrol
 
Lecture 10 - Java Server Faces (JSF)
Fahad Golra
 
A Complete Tour of JSF 2
Jim Driscoll
 
JSF basics
airbo
 
JSF Component Behaviors
Andy Schwartz
 
TY.BSc.IT Java QB U5&6
Lokesh Singrol
 
Struts Introduction Course
guest764934
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
Java EE Introduction
ejlp12
 
Spring - Part 4 - Spring MVC
Hitesh-Java
 
Jsf2.0 -4
Vinay Kumar
 

Similar to Java Web Programming [7/9] : Struts2 Basics (20)

PDF
Struts An Open-source Architecture for Web Applications
elliando dias
 
PDF
Web Development with Apache Struts 2
Fabrizio Giudici
 
PDF
Step By Step Guide For Buidling Simple Struts App
Syed Shahul
 
PDF
Introduction to Struts 1.3
Ilio Catallo
 
PDF
Stepbystepguideforbuidlingsimplestrutsapp 090702025438-phpapp02
Rati Manandhar
 
PPTX
struts unit best pdf for struts java.pptx
ozakamal8
 
DOCX
Struts Interview Questions
jbashask
 
PPT
strut2
sudarshan9
 
PDF
Step By Step Guide For Buidling Simple Struts App Speakernoted
Harjinder Singh
 
PPT
Jakarta struts
rajeevsingh141
 
DOCX
Struts notes
Rajeev Uppala
 
PDF
Struts Basics
Harjinder Singh
 
PDF
important struts interview questions
surendray
 
PPS
Struts Java I I Lecture 8
patinijava
 
PDF
Introduction to struts
Mindfire Solutions
 
PPT
Struts
Ranjan Kumar
 
PPT
Struts 2-overview2
divzi1913
 
PDF
Struts Action
Vijay subedar
 
Struts An Open-source Architecture for Web Applications
elliando dias
 
Web Development with Apache Struts 2
Fabrizio Giudici
 
Step By Step Guide For Buidling Simple Struts App
Syed Shahul
 
Introduction to Struts 1.3
Ilio Catallo
 
Stepbystepguideforbuidlingsimplestrutsapp 090702025438-phpapp02
Rati Manandhar
 
struts unit best pdf for struts java.pptx
ozakamal8
 
Struts Interview Questions
jbashask
 
strut2
sudarshan9
 
Step By Step Guide For Buidling Simple Struts App Speakernoted
Harjinder Singh
 
Jakarta struts
rajeevsingh141
 
Struts notes
Rajeev Uppala
 
Struts Basics
Harjinder Singh
 
important struts interview questions
surendray
 
Struts Java I I Lecture 8
patinijava
 
Introduction to struts
Mindfire Solutions
 
Struts
Ranjan Kumar
 
Struts 2-overview2
divzi1913
 
Struts Action
Vijay subedar
 
Ad

More from IMC Institute (20)

PDF
นิตยสาร Digital Trends ฉบับที่ 14
IMC Institute
 
PDF
Digital trends Vol 4 No. 13 Sep-Dec 2019
IMC Institute
 
PDF
บทความ The evolution of AI
IMC Institute
 
PDF
IT Trends eMagazine Vol 4. No.12
IMC Institute
 
PDF
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
IMC Institute
 
PDF
IT Trends 2019: Putting Digital Transformation to Work
IMC Institute
 
PDF
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
IMC Institute
 
PDF
IT Trends eMagazine Vol 4. No.11
IMC Institute
 
PDF
แนวทางการทำ Digital transformation
IMC Institute
 
PDF
บทความ The New Silicon Valley
IMC Institute
 
PDF
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
IMC Institute
 
PDF
แนวทางการทำ Digital transformation
IMC Institute
 
PDF
The Power of Big Data for a new economy (Sample)
IMC Institute
 
PDF
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
IMC Institute
 
PDF
IT Trends eMagazine Vol 3. No.9
IMC Institute
 
PDF
Thailand software & software market survey 2016
IMC Institute
 
PPTX
Developing Business Blockchain Applications on Hyperledger
IMC Institute
 
PDF
Digital transformation @thanachart.org
IMC Institute
 
PDF
บทความ Big Data จากบล็อก thanachart.org
IMC Institute
 
PDF
กลยุทธ์ 5 ด้านกับการทำ Digital Transformation
IMC Institute
 
นิตยสาร Digital Trends ฉบับที่ 14
IMC Institute
 
Digital trends Vol 4 No. 13 Sep-Dec 2019
IMC Institute
 
บทความ The evolution of AI
IMC Institute
 
IT Trends eMagazine Vol 4. No.12
IMC Institute
 
เพราะเหตุใด Digitization ไม่ตอบโจทย์ Digital Transformation
IMC Institute
 
IT Trends 2019: Putting Digital Transformation to Work
IMC Institute
 
มูลค่าตลาดดิจิทัลไทย 3 อุตสาหกรรม
IMC Institute
 
IT Trends eMagazine Vol 4. No.11
IMC Institute
 
แนวทางการทำ Digital transformation
IMC Institute
 
บทความ The New Silicon Valley
IMC Institute
 
นิตยสาร IT Trends ของ IMC Institute ฉบับที่ 10
IMC Institute
 
แนวทางการทำ Digital transformation
IMC Institute
 
The Power of Big Data for a new economy (Sample)
IMC Institute
 
บทความ Robotics แนวโน้มใหม่สู่บริการเฉพาะทาง
IMC Institute
 
IT Trends eMagazine Vol 3. No.9
IMC Institute
 
Thailand software & software market survey 2016
IMC Institute
 
Developing Business Blockchain Applications on Hyperledger
IMC Institute
 
Digital transformation @thanachart.org
IMC Institute
 
บทความ Big Data จากบล็อก thanachart.org
IMC Institute
 
กลยุทธ์ 5 ด้านกับการทำ Digital Transformation
IMC Institute
 
Ad

Recently uploaded (20)

PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Python basic programing language for automation
DanialHabibi2
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 

Java Web Programming [7/9] : Struts2 Basics

  • 1. Module 7: Struts 2 Basics Thanisa Kruawaisayawan Thanachart Numnonda www.imcinstitute.com
  • 2. Apache Struts  Struts is an open source Web application framework developed as Apache Jakarta project  http://jakarta.apache.org/struts/  Model-View-Controller (MVC) framework  Used for constructing web applications based Servlets and JSP technologies  Strutsapplication is a genuine Web application that should be able to run on any Servlet container including all Java EE compliant App servers 2
  • 3. Why Struts?  Takes much of the complexity out of building your own MVC framework  Encourages good design practice and modeling  Easy to learn and use  Feature-rich and many supported 3rd-party tools  Flexible and extensible  Large user community  Stable and mature  Open source 3
  • 4. How Struts 2 Works 4
  • 6. Steps 1. Write JSP pages (View) 2. Write Action class (Model) 3. Forward at either success or error through configuration set in struts.xml 4. Build, deploy, and test the application 6
  • 7. Step 1: Write JSP pages 7
  • 8. JSP Pages  Write one JSP page for each view  Use Struts tags for  Handing HTML input forms  Writing out messages 8
  • 11. Step 2: Write Action classes 11
  • 12. Action Class Extend com.opensymphony.xwork2.ActionSupport class  Decide set of properties that reflect the input form  Write getter and setter methods for each property  Write execute() method 12
  • 14. Step 3: Config struts.xml 14
  • 15. struts.xml  Identify required Action's and then define them as <action> elements 15
  • 16. Step 5: Build, Deploy, and Test Application 16
  • 17. Results 17
  • 18. Acknowledgement Most contents are borrowed from the presentation slides of Sang Shin, Java™ Technology Evangelist, Sun Microsystems, Inc. 18
  • 19. Thank you [email protected] www.facebook.com/imcinstitute www.imcinstitute.com 19