SlideShare a Scribd company logo
1 of 14
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

What's hot

Action Guide Reg Process
Action Guide Reg ProcessAction Guide Reg Process
Action Guide Reg Processceleroo
 
CDP Proposal
CDP ProposalCDP Proposal
CDP Proposaltectonar
 
Lab 2: Importing requirements artifacts from a CSV file
Lab 2: Importing requirements artifacts from a CSV file Lab 2: Importing requirements artifacts from a CSV file
Lab 2: Importing requirements artifacts from a CSV file IBM Rational software
 
Metamorphosis from Forms to Java: A technical lead's perspective, part II
Metamorphosis from Forms to Java:  A technical lead's perspective, part IIMetamorphosis from Forms to Java:  A technical lead's perspective, part II
Metamorphosis from Forms to Java: A technical lead's perspective, part IIMichael Fons
 
The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...
The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...
The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...ParshantiniRoy
 
Oracle Forms Creation
Oracle Forms CreationOracle Forms Creation
Oracle Forms CreationSekhar Byna
 

What's hot (11)

View
ViewView
View
 
Ppt ch11
Ppt ch11Ppt ch11
Ppt ch11
 
Les04
Les04Les04
Les04
 
Action Guide Reg Process
Action Guide Reg ProcessAction Guide Reg Process
Action Guide Reg Process
 
CDP Proposal
CDP ProposalCDP Proposal
CDP Proposal
 
Lab 2: Importing requirements artifacts from a CSV file
Lab 2: Importing requirements artifacts from a CSV file Lab 2: Importing requirements artifacts from a CSV file
Lab 2: Importing requirements artifacts from a CSV file
 
Metamorphosis from Forms to Java: A technical lead's perspective, part II
Metamorphosis from Forms to Java:  A technical lead's perspective, part IIMetamorphosis from Forms to Java:  A technical lead's perspective, part II
Metamorphosis from Forms to Java: A technical lead's perspective, part II
 
The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...
The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...
The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...
 
Les02
Les02Les02
Les02
 
Oracle Forms Creation
Oracle Forms CreationOracle Forms Creation
Oracle Forms Creation
 
Sharepoint 2013
Sharepoint 2013Sharepoint 2013
Sharepoint 2013
 

Viewers also liked

8. java script
8. java script8. java script
8. java scriptAnusAhmad
 
9. java server faces
9. java server faces9. java server faces
9. java server facesAnusAhmad
 
Pesquisa cnt mda_relatorio sintese - cnt junho2013 - r113 - final
Pesquisa cnt mda_relatorio sintese - cnt junho2013 - r113 - finalPesquisa cnt mda_relatorio sintese - cnt junho2013 - r113 - final
Pesquisa cnt mda_relatorio sintese - cnt junho2013 - r113 - finalFolha de Pernambuco
 
Resource management
Resource managementResource management
Resource managementmbondgulo
 
Paula ardila actividad1_mapc
Paula ardila actividad1_mapcPaula ardila actividad1_mapc
Paula ardila actividad1_mapcandrea_ardila
 
Vijay Pandit Palam
Vijay Pandit PalamVijay Pandit Palam
Vijay Pandit PalamVijay Pandit
 
Trabajo grupal 4⺠e.p. grupo b 12. espaã±a en la edad contemporã¡nea (1)
Trabajo grupal 4⺠e.p. grupo b 12. espaã±a en la edad contemporã¡nea  (1)Trabajo grupal 4⺠e.p. grupo b 12. espaã±a en la edad contemporã¡nea  (1)
Trabajo grupal 4⺠e.p. grupo b 12. espaã±a en la edad contemporã¡nea (1)Richy Perez
 
1 tg tecnicas de combate al contrabando en fronteras del estado zulia - ruben -
1 tg  tecnicas de combate al contrabando en fronteras del estado zulia - ruben -1 tg  tecnicas de combate al contrabando en fronteras del estado zulia - ruben -
1 tg tecnicas de combate al contrabando en fronteras del estado zulia - ruben -ruben10637348
 
Rede mundo maior´ apresentação
Rede mundo maior´  apresentaçãoRede mundo maior´  apresentação
Rede mundo maior´ apresentaçãoMagali Bischoff
 
Where to start with power cli
Where to start with power cliWhere to start with power cli
Where to start with power cliChris Halverson
 

Viewers also liked (13)

8. java script
8. java script8. java script
8. java script
 
9. java server faces
9. java server faces9. java server faces
9. java server faces
 
Pesquisa cnt mda_relatorio sintese - cnt junho2013 - r113 - final
Pesquisa cnt mda_relatorio sintese - cnt junho2013 - r113 - finalPesquisa cnt mda_relatorio sintese - cnt junho2013 - r113 - final
Pesquisa cnt mda_relatorio sintese - cnt junho2013 - r113 - final
 
Resource management
Resource managementResource management
Resource management
 
De Eerstelijns Juni 2013
De Eerstelijns Juni 2013De Eerstelijns Juni 2013
De Eerstelijns Juni 2013
 
Paula ardila actividad1_mapc
Paula ardila actividad1_mapcPaula ardila actividad1_mapc
Paula ardila actividad1_mapc
 
Vijay Pandit Palam
Vijay Pandit PalamVijay Pandit Palam
Vijay Pandit Palam
 
Trabajo grupal 4⺠e.p. grupo b 12. espaã±a en la edad contemporã¡nea (1)
Trabajo grupal 4⺠e.p. grupo b 12. espaã±a en la edad contemporã¡nea  (1)Trabajo grupal 4⺠e.p. grupo b 12. espaã±a en la edad contemporã¡nea  (1)
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 -
1 tg  tecnicas de combate al contrabando en fronteras del estado zulia - ruben -1 tg  tecnicas de combate al contrabando en fronteras del estado zulia - ruben -
1 tg tecnicas de combate al contrabando en fronteras del estado zulia - ruben -
 
Resolución 030 2015
Resolución 030 2015Resolución 030 2015
Resolución 030 2015
 
Rede mundo maior´ apresentação
Rede mundo maior´  apresentaçãoRede mundo maior´  apresentação
Rede mundo maior´ apresentação
 
Filósofos solares
Filósofos solaresFilósofos solares
Filósofos solares
 
Where to start with power cli
Where to start with power cliWhere to start with power cli
Where to start with power cli
 

Similar to 7. struts

08052917365603
0805291736560308052917365603
08052917365603DSKUMAR G
 
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universitylhkslkdh89009
 
Struts tutorial
Struts tutorialStruts tutorial
Struts tutorialOPENLANE
 
Claims based authentication in share point 2010 .new
Claims based authentication in share point 2010 .newClaims based authentication in share point 2010 .new
Claims based authentication in share point 2010 .newRavikantChaturvedi
 
Cis407 a ilab 3 web application development devry university
Cis407 a ilab 3 web application development devry universityCis407 a ilab 3 web application development devry university
Cis407 a ilab 3 web application development devry universitylhkslkdh89009
 
Parallelminds.asp.net with sp
Parallelminds.asp.net with spParallelminds.asp.net with sp
Parallelminds.asp.net with spparallelminder
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08Vivek chan
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCBarry Gervin
 
Open microsoft visual studio/tutorialoutlet
Open microsoft visual studio/tutorialoutletOpen microsoft visual studio/tutorialoutlet
Open microsoft visual studio/tutorialoutletMitchinson
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To MvcVolkan Uzun
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08Mani Chaubey
 

Similar to 7. struts (20)

Jsf
JsfJsf
Jsf
 
Struts Intro
Struts IntroStruts Intro
Struts Intro
 
08052917365603
0805291736560308052917365603
08052917365603
 
Struts Overview
Struts OverviewStruts Overview
Struts Overview
 
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry university
 
Struts tutorial
Struts tutorialStruts tutorial
Struts tutorial
 
MVC Training Part 1
MVC Training Part 1MVC Training Part 1
MVC Training Part 1
 
Claims based authentication in share point 2010 .new
Claims based authentication in share point 2010 .newClaims based authentication in share point 2010 .new
Claims based authentication in share point 2010 .new
 
Cis407 a ilab 3 web application development devry university
Cis407 a ilab 3 web application development devry universityCis407 a ilab 3 web application development devry university
Cis407 a ilab 3 web application development devry university
 
Parallelminds.asp.net with sp
Parallelminds.asp.net with spParallelminds.asp.net with sp
Parallelminds.asp.net with sp
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 
Chapter12 (1)
Chapter12 (1)Chapter12 (1)
Chapter12 (1)
 
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
 
Open microsoft visual studio/tutorialoutlet
Open microsoft visual studio/tutorialoutletOpen microsoft visual studio/tutorialoutlet
Open microsoft visual studio/tutorialoutlet
 
Oracle ADF 11g Tutorial
Oracle ADF 11g TutorialOracle ADF 11g Tutorial
Oracle ADF 11g Tutorial
 
Struts N E W
Struts N E WStruts N E W
Struts N E W
 
Web forms in ASP.net
Web forms in ASP.netWeb forms in ASP.net
Web forms in ASP.net
 
Jsf intro
Jsf introJsf intro
Jsf intro
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 

More from AnusAhmad

[Www.pkbulk.blogspot.com]file and indexing
[Www.pkbulk.blogspot.com]file and indexing[Www.pkbulk.blogspot.com]file and indexing
[Www.pkbulk.blogspot.com]file and indexingAnusAhmad
 
[Www.pkbulk.blogspot.com]dbms12
[Www.pkbulk.blogspot.com]dbms12[Www.pkbulk.blogspot.com]dbms12
[Www.pkbulk.blogspot.com]dbms12AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms10
[Www.pkbulk.blogspot.com]dbms10[Www.pkbulk.blogspot.com]dbms10
[Www.pkbulk.blogspot.com]dbms10AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms09
[Www.pkbulk.blogspot.com]dbms09[Www.pkbulk.blogspot.com]dbms09
[Www.pkbulk.blogspot.com]dbms09AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms07
[Www.pkbulk.blogspot.com]dbms07[Www.pkbulk.blogspot.com]dbms07
[Www.pkbulk.blogspot.com]dbms07AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms06
[Www.pkbulk.blogspot.com]dbms06[Www.pkbulk.blogspot.com]dbms06
[Www.pkbulk.blogspot.com]dbms06AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms05
[Www.pkbulk.blogspot.com]dbms05[Www.pkbulk.blogspot.com]dbms05
[Www.pkbulk.blogspot.com]dbms05AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms04
[Www.pkbulk.blogspot.com]dbms04[Www.pkbulk.blogspot.com]dbms04
[Www.pkbulk.blogspot.com]dbms04AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms01
[Www.pkbulk.blogspot.com]dbms01[Www.pkbulk.blogspot.com]dbms01
[Www.pkbulk.blogspot.com]dbms01AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms13
[Www.pkbulk.blogspot.com]dbms13[Www.pkbulk.blogspot.com]dbms13
[Www.pkbulk.blogspot.com]dbms13AnusAhmad
 
2. http, html
2. http, html2. http, html
2. http, htmlAnusAhmad
 
6. hibernate
6. hibernate6. hibernate
6. hibernateAnusAhmad
 

More from AnusAhmad (19)

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

Recently uploaded

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.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