IMRAN DAUD
FOUNDATION UNIVERSITY
INSTITUTE OF MANAGEMENT AND
COMPUTER SCIENCES
Imran Daud
FUIMCS
Web Engineering
Struts
What is Struts?
 A framework based on MVC architecture.
Source: java.sun.com
Overview of Struts Application
Creating Struts Application
 Create web Project and select struts as framework.
Action Servlet
Name
Action URL
Pattern
Login.jsp
 Create Login jsp page.
 Add following taglibs i.e. html
 <%@ taglib uri="http://struts.apache.org/tags-html"
prefix="html" %>
 Add form using html
 <html:form action="/login">
 <html:submit value="Login" />
 </html:form>
 Add table using palette and two text fields using html
tag.
success.jsp
 Add bean tag at top of page by using strut bean
taglib.
 Now add following:
ActionForm Bean
 This bean used to persist data between requests.
 When user submits data, it is stored temporarily in
form bean. To be redisplayed in form page in case of
format problem or in success page.
 To add actionForm bean, create new actionForm
bean from strut category and give name
LoginForm.java.
 Add email variable in LoginForm.java bean and add
setter and getter functions.
 After that you can see changes appear in struts-
config.xml file.
Action Class
 When form is received, function of action object is
executed and data is processed. It also decides which
view to forward processed data.
 Create Action Class from wizard from struts category
by giving name LoginAction with following:
Same Path given
in form of login
page
 Associate action class with form bean (LoginForm.java) previously created.
 Delete forward slash from input resource.
 Set scope to Request.
 Deselect the Validate ActionForm Bean option
Validate Form
 Your LoginAction file will look like this:
 It redirects the request for success view.
 But is desirable to validate input before forwarding it to appropriate view.
Validate LoginAction
Adding forward Entries to struts-
config.xml
 In order for the application to match JSP pages with forwarding conditions
returned by LoginAction's execute method, you need to add forward entries to
the struts-config.xml file.
 Open struts-config.xml amd right click anywhere in file.
 select struts and add forward and add following:
Setting welcome page in web.xml
 Goto Page tab og web.xml file and change the
welcome file to login.jsp
 That’s it
Reference
 http://www.csl.mtu.edu/cs2321/
 Netbeans.org
 Roseindia.net
 Jsptut.com
 tutorialspoint.com/jsp
 http://java.sun.com

More Related Content

PDF
Ivanti Cheat Sheet by Traversys Limited
PDF
Tutorial 3 accessing the database
PDF
Admin Habits & Hacks Handout - Salesforce World Tour Boston
PPS
C# Work Samples
PDF
Lab 2: Creating views at the project level in the web client
PPT
FormObject For Building Complex Forms. Dmytro Pilugin
PPT
Les04
DOCX
Batch element entry BEE
Ivanti Cheat Sheet by Traversys Limited
Tutorial 3 accessing the database
Admin Habits & Hacks Handout - Salesforce World Tour Boston
C# Work Samples
Lab 2: Creating views at the project level in the web client
FormObject For Building Complex Forms. Dmytro Pilugin
Les04
Batch element entry BEE

What's hot (11)

PPTX
PPT
Ppt ch11
PPT
PPT
Action Guide Reg Process
PPT
CDP Proposal
PDF
Lab 2: Importing requirements artifacts from a CSV file
PPT
Metamorphosis from Forms to Java: A technical lead's perspective, part II
PDF
The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...
PPT
Les02
PPT
Oracle Forms Creation
PPTX
Sharepoint 2013
Ppt ch11
Action Guide Reg Process
CDP Proposal
Lab 2: Importing requirements artifacts from a CSV file
Metamorphosis from Forms to Java: A technical lead's perspective, part II
The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...
Les02
Oracle Forms Creation
Sharepoint 2013
Ad

Viewers also liked (13)

PPTX
8. java script
PPTX
9. java server faces
PDF
Pesquisa cnt mda_relatorio sintese - cnt junho2013 - r113 - final
PPTX
Resource management
PDF
De Eerstelijns Juni 2013
PDF
Paula ardila actividad1_mapc
DOCX
Vijay Pandit Palam
PDF
Trabajo grupal 4⺠e.p. grupo b 12. espaã±a en la edad contemporã¡nea (1)
PDF
1 tg tecnicas de combate al contrabando en fronteras del estado zulia - ruben -
PDF
Resolución 030 2015
PPT
Rede mundo maior´ apresentação
PPT
Filósofos solares
PPTX
Where to start with power cli
8. java script
9. java server faces
Pesquisa cnt mda_relatorio sintese - cnt junho2013 - r113 - final
Resource management
De Eerstelijns Juni 2013
Paula ardila actividad1_mapc
Vijay Pandit Palam
Trabajo grupal 4⺠e.p. grupo b 12. espaã±a en la edad contemporã¡nea (1)
1 tg tecnicas de combate al contrabando en fronteras del estado zulia - ruben -
Resolución 030 2015
Rede mundo maior´ apresentação
Filósofos solares
Where to start with power cli
Ad

Similar to 7. struts (20)

PPT
08052917365603
PPT
Struts Intro
PPT
Struts Overview
DOC
Cis407 a ilab 6 web application development devry university
PDF
Struts tutorial
PPTX
MVC Training Part 1
PDF
Claims based authentication in share point 2010 .new
PPTX
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
PDF
Design Patterns in Automation Framework.pdf
DOC
Cis407 a ilab 3 web application development devry university
PPTX
Parallelminds.asp.net with sp
PPSX
06 asp.net session08
PPT
Chapter12 (1)
PPT
CTTDNUG ASP.NET MVC
DOC
Open microsoft visual studio/tutorialoutlet
PDF
Get Distributed and Cloud Computing 1st Edition Hwang Solutions Manual free a...
PDF
Oracle ADF 11g Tutorial
PDF
Download full Distributed and Cloud Computing 1st Edition Hwang Solutions Man...
PPT
Struts N E W
08052917365603
Struts Intro
Struts Overview
Cis407 a ilab 6 web application development devry university
Struts tutorial
MVC Training Part 1
Claims based authentication in share point 2010 .new
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
Design Patterns in Automation Framework.pdf
Cis407 a ilab 3 web application development devry university
Parallelminds.asp.net with sp
06 asp.net session08
Chapter12 (1)
CTTDNUG ASP.NET MVC
Open microsoft visual studio/tutorialoutlet
Get Distributed and Cloud Computing 1st Edition Hwang Solutions Manual free a...
Oracle ADF 11g Tutorial
Download full Distributed and Cloud Computing 1st Edition Hwang Solutions Man...
Struts N E W

More from AnusAhmad (19)

PPT
[Www.pkbulk.blogspot.com]file and indexing
PDF
[Www.pkbulk.blogspot.com]dbms12
PDF
[Www.pkbulk.blogspot.com]dbms11
PDF
[Www.pkbulk.blogspot.com]dbms10
PDF
[Www.pkbulk.blogspot.com]dbms09
PDF
[Www.pkbulk.blogspot.com]dbms07
PDF
[Www.pkbulk.blogspot.com]dbms06
PDF
[Www.pkbulk.blogspot.com]dbms05
PDF
[Www.pkbulk.blogspot.com]dbms04
PDF
[Www.pkbulk.blogspot.com]dbms03
PDF
[Www.pkbulk.blogspot.com]dbms02
PDF
[Www.pkbulk.blogspot.com]dbms01
PDF
[Www.pkbulk.blogspot.com]dbms13
PPTX
5. servlets
PPTX
4. jsp
PPTX
3. applets
PPTX
2. http, html
PPTX
1. intro
PPTX
6. hibernate
[Www.pkbulk.blogspot.com]file and indexing
[Www.pkbulk.blogspot.com]dbms12
[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms10
[Www.pkbulk.blogspot.com]dbms09
[Www.pkbulk.blogspot.com]dbms07
[Www.pkbulk.blogspot.com]dbms06
[Www.pkbulk.blogspot.com]dbms05
[Www.pkbulk.blogspot.com]dbms04
[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms01
[Www.pkbulk.blogspot.com]dbms13
5. servlets
4. jsp
3. applets
2. http, html
1. intro
6. hibernate

Recently uploaded (20)

PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
My India Quiz Book_20210205121199924.pdf
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
Hazard Identification & Risk Assessment .pdf
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
PDF
HVAC Specification 2024 according to central public works department
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PPTX
TNA_Presentation-1-Final(SAVE)) (1).pptx
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
Paper A Mock Exam 9_ Attempt review.pdf.
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
Environmental Education MCQ BD2EE - Share Source.pdf
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
What if we spent less time fighting change, and more time building what’s rig...
My India Quiz Book_20210205121199924.pdf
A powerpoint presentation on the Revised K-10 Science Shaping Paper
Hazard Identification & Risk Assessment .pdf
B.Sc. DS Unit 2 Software Engineering.pptx
HVAC Specification 2024 according to central public works department
Chinmaya Tiranga quiz Grand Finale.pdf
Cambridge-Practice-Tests-for-IELTS-12.docx
Unit 4 Computer Architecture Multicore Processor.pptx
Practical Manual AGRO-233 Principles and Practices of Natural Farming
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
TNA_Presentation-1-Final(SAVE)) (1).pptx

7. struts

  • 1. IMRAN DAUD FOUNDATION UNIVERSITY INSTITUTE OF MANAGEMENT AND COMPUTER SCIENCES Imran Daud FUIMCS Web Engineering Struts
  • 2. What is Struts?  A framework based on MVC architecture. Source: java.sun.com
  • 3. Overview of Struts Application
  • 4. Creating Struts Application  Create web Project and select struts as framework. Action Servlet Name Action URL Pattern
  • 5. Login.jsp  Create Login jsp page.  Add following taglibs i.e. html  <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>  Add form using html  <html:form action="/login">  <html:submit value="Login" />  </html:form>  Add table using palette and two text fields using html tag.
  • 6. success.jsp  Add bean tag at top of page by using strut bean taglib.  Now add following:
  • 7. ActionForm Bean  This bean used to persist data between requests.  When user submits data, it is stored temporarily in form bean. To be redisplayed in form page in case of format problem or in success page.  To add actionForm bean, create new actionForm bean from strut category and give name LoginForm.java.  Add email variable in LoginForm.java bean and add setter and getter functions.  After that you can see changes appear in struts- config.xml file.
  • 8. Action Class  When form is received, function of action object is executed and data is processed. It also decides which view to forward processed data.  Create Action Class from wizard from struts category by giving name LoginAction with following: Same Path given in form of login page
  • 9.  Associate action class with form bean (LoginForm.java) previously created.  Delete forward slash from input resource.  Set scope to Request.  Deselect the Validate ActionForm Bean option
  • 10. Validate Form  Your LoginAction file will look like this:  It redirects the request for success view.  But is desirable to validate input before forwarding it to appropriate view.
  • 12. Adding forward Entries to struts- config.xml  In order for the application to match JSP pages with forwarding conditions returned by LoginAction's execute method, you need to add forward entries to the struts-config.xml file.  Open struts-config.xml amd right click anywhere in file.  select struts and add forward and add following:
  • 13. Setting welcome page in web.xml  Goto Page tab og web.xml file and change the welcome file to login.jsp  That’s it
  • 14. Reference  http://www.csl.mtu.edu/cs2321/  Netbeans.org  Roseindia.net  Jsptut.com  tutorialspoint.com/jsp  http://java.sun.com