Web Application Development Using Struts 1.2.9 Ranjan Kumar Project Engineer SE Division CDAC Mumbai
Agenda <ul><li>1. Introduction </li></ul><ul><li>2. Struts  Controller  Components </li></ul><ul><li>3. Struts  Model  Com...
1. Introduction <ul><li>What is struts? </li></ul><ul><ul><li>Open source , by  ASF ,  framework , based on  MVC  Architec...
The Struts framework is used within web tier.
How to proceed with struts framework? <ul><ul><li>Where to get it from? </li></ul></ul><ul><ul><li>http://struts.apache.or...
MVC in Struts Framework
2. Struts Controller  Components <ul><li>The Struts  ActionServlet </li></ul><ul><ul><li>It extends  HttpServlet . </li></...
<ul><li>Struts  ActionForward  class </li></ul><ul><li>Struts  ActionMapping  class </li></ul><ul><ul><li>findForward()   ...
<ul><li>The “M” in MVC </li></ul><ul><li>Types of Models </li></ul><ul><ul><li>The conceptual model </li></ul></ul><ul><ul...
4. Struts  View  Components <ul><li>HTML documents </li></ul><ul><li>JSP custom tag libraries  </li></ul><ul><li>JavaScrip...
Using the Struts ActionForm <ul><ul><li>Also called form bean. </li></ul></ul><ul><ul><li>getter ,  setter ,  reset()  and...
The lifecycle of an ActionForm
5.   Configuring Struts Application <ul><li>Configuring the  web.xml  File for Struts </li></ul><ul><ul><li>Mapping the St...
<ul><li>The Struts Configuration File </li></ul><ul><ul><li>Configuring Multiple Application Module </li></ul></ul><ul><ul...
6. Sample Application Leave Management Module of Human Resource Management System
7. Validation Framework <ul><li>What is validation? </li></ul><ul><li>Using the  validate()  method of ActionForm </li></u...
8. Tiles Framework <ul><li>What is a Template? </li></ul><ul><ul><ul><li>A  template  is a JSP page that uses a JSP custom...
9. Summary
Thanks…
Upcoming SlideShare
Loading in …5
×

Struts

5,641 views

Published on

Published in: Technology, Education
1 Comment
5 Likes
Statistics
Notes
  • why not to download anymore so ?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
5,641
On SlideShare
0
From Embeds
0
Number of Embeds
377
Actions
Shares
0
Downloads
210
Comments
1
Likes
5
Embeds 0
No embeds

No notes for slide

Struts

  1. 1. Web Application Development Using Struts 1.2.9 Ranjan Kumar Project Engineer SE Division CDAC Mumbai
  2. 2. Agenda <ul><li>1. Introduction </li></ul><ul><li>2. Struts Controller Components </li></ul><ul><li>3. Struts Model Components </li></ul><ul><li>4. Struts View Components </li></ul><ul><li>5. Configuring Struts Application </li></ul><ul><li>6. Sample Application </li></ul><ul><li>7. Validation Framework </li></ul><ul><li>8. Tiles Framework </li></ul><ul><li>9. Summary </li></ul>
  3. 3. 1. Introduction <ul><li>What is struts? </li></ul><ul><ul><li>Open source , by ASF , framework , based on MVC Architecture. </li></ul></ul><ul><ul><li>Struts 1.2.9 </li></ul></ul><ul><ul><li>Struts 1.3.5 beta </li></ul></ul><ul><ul><li>Struts 2 (WebWork 2) </li></ul></ul><ul><li>The struts framework is used within the web tier. </li></ul><ul><li>How to proceed with struts framework? </li></ul><ul><ul><li>Where to get it from? </li></ul></ul><ul><ul><li>Package Structure? </li></ul></ul><ul><ul><li>Using struts-blank ? </li></ul></ul>
  4. 4. The Struts framework is used within web tier.
  5. 5. How to proceed with struts framework? <ul><ul><li>Where to get it from? </li></ul></ul><ul><ul><li>http://struts.apache.org/download.cgi </li></ul></ul><ul><ul><li>struts-1.2.9-bin.zip [ PGP ] [ MD5 ] </li></ul></ul><ul><ul><li>Package Structure? </li></ul></ul><ul><ul><li>Using struts-blank? </li></ul></ul>
  6. 6. MVC in Struts Framework
  7. 7. 2. Struts Controller Components <ul><li>The Struts ActionServlet </li></ul><ul><ul><li>It extends HttpServlet . </li></ul></ul><ul><ul><ul><li>process () method </li></ul></ul></ul><ul><ul><li>Version 1.1 before and after . </li></ul></ul><ul><ul><li>RequestProcessor </li></ul></ul><ul><ul><ul><li>process () method </li></ul></ul></ul><ul><ul><li>Configuring ActionServlet and RequestProcessor </li></ul></ul><ul><li>Struts Action Class </li></ul><ul><ul><li>Execute() Method in some Action class </li></ul></ul><ul><ul><li>Action tag in struts-config.xml </li></ul></ul>
  8. 8. <ul><li>Struts ActionForward class </li></ul><ul><li>Struts ActionMapping class </li></ul><ul><ul><li>findForward() Method </li></ul></ul><ul><li>Business Logic and the Action class </li></ul><ul><li>Using the Prebuilt Struts Actions </li></ul><ul><ul><li>org.apache.struts.actions.ForwardAction class </li></ul></ul><ul><ul><li>org.apache.struts.actions.IncludeAction class </li></ul></ul><ul><ul><li>org.apache.struts.actions.DispatchAction class </li></ul></ul>
  9. 9. <ul><li>The “M” in MVC </li></ul><ul><li>Types of Models </li></ul><ul><ul><li>The conceptual model </li></ul></ul><ul><ul><ul><li>The ER diagrams </li></ul></ul></ul><ul><ul><li>The design model </li></ul></ul><ul><ul><ul><li>The class diagrams </li></ul></ul></ul><ul><li>What Is a Business Object? </li></ul><ul><ul><li>A business object(BO) is simply a software abstraction of a real-world entity. </li></ul></ul><ul><li>Requirements for Business Objects </li></ul><ul><ul><li>Consists of state and behavior </li></ul></ul><ul><ul><li>Represents a person, place, thing, or concept from the business domain </li></ul></ul><ul><ul><li>Is reusable. </li></ul></ul><ul><li>Types of business objects </li></ul><ul><ul><li>Entity business object </li></ul></ul><ul><ul><li>Process business object </li></ul></ul><ul><ul><li>Event business object </li></ul></ul>3. Struts Model Components
  10. 10. 4. Struts View Components <ul><li>HTML documents </li></ul><ul><li>JSP custom tag libraries </li></ul><ul><li>JavaScript and stylesheet </li></ul><ul><li>Multimedia files </li></ul><ul><ul><li>Images (.gif, .jpg, etc.) </li></ul></ul><ul><ul><li>Audio (.wav, .mp3, etc.) </li></ul></ul><ul><ul><li>Video (.avi, .mpg, etc.) </li></ul></ul><ul><li>Message resource bundles </li></ul><ul><ul><li>Internationalization </li></ul></ul><ul><ul><li>Reduce maintenance time and redundancy throughout an application. </li></ul></ul><ul><li>ActionForm classes </li></ul>
  11. 11. Using the Struts ActionForm <ul><ul><li>Also called form bean. </li></ul></ul><ul><ul><li>getter , setter , reset() and validate() </li></ul></ul><ul><ul><li>methods. </li></ul></ul><ul><ul><li>Declaring ActionForm in the Struts Configuration File </li></ul></ul><ul><ul><li>ActionForm can have two different levels of </li></ul></ul><ul><ul><li>scope: request and session. </li></ul></ul><ul><ul><li>Using an ActionForm in an Action. </li></ul></ul><ul><ul><li>Lifecycle of ActionForm : </li></ul></ul><ul><ul><li>DynaActionForm </li></ul></ul>
  12. 12. The lifecycle of an ActionForm
  13. 13. 5. Configuring Struts Application <ul><li>Configuring the web.xml File for Struts </li></ul><ul><ul><li>Mapping the Struts ActionServlet </li></ul></ul><ul><ul><li>Specifying Multiple Application Module </li></ul></ul><ul><ul><li>Declare the Initialization Parameters </li></ul></ul><ul><ul><li>Configuring Tag Libraries </li></ul></ul><ul><ul><li>Setting Up the Welcome File List </li></ul></ul><ul><ul><li>Configuring Error Handling in web.xml </li></ul></ul>
  14. 14. <ul><li>The Struts Configuration File </li></ul><ul><ul><li>Configuring Multiple Application Module </li></ul></ul><ul><ul><ul><li>struts-config.xml , </li></ul></ul></ul><ul><ul><ul><li>org.apache.struts.config Package </li></ul></ul></ul><ul><ul><ul><ul><li>ApplicationConfig Class </li></ul></ul></ul></ul><ul><ul><li>struts-config.xml </li></ul></ul><ul><ul><ul><li>The data-sources element </li></ul></ul></ul><ul><ul><ul><li>The form-beans element </li></ul></ul></ul><ul><ul><ul><li>The global-exceptions element </li></ul></ul></ul><ul><ul><ul><li>The global-forwards element </li></ul></ul></ul><ul><ul><ul><li>The action-mappings element </li></ul></ul></ul><ul><ul><ul><li>The controller element </li></ul></ul></ul><ul><ul><ul><li>The message-resources element </li></ul></ul></ul><ul><ul><ul><li>The plug-in element </li></ul></ul></ul>
  15. 15. 6. Sample Application Leave Management Module of Human Resource Management System
  16. 16. 7. Validation Framework <ul><li>What is validation? </li></ul><ul><li>Using the validate() method of ActionForm </li></ul><ul><ul><li>Demerits- </li></ul></ul><ul><ul><ul><li>redundancy of code. </li></ul></ul></ul><ul><ul><ul><li>maintenance problem (recompilation). </li></ul></ul></ul><ul><li>Using Validation Framework . </li></ul><ul><ul><li>The validation framework allows us to move all the validation logic completely outside the ActionForm and declaratively configure it for an application through external xml files . </li></ul></ul><ul><li>Installing and configuring the Validator . </li></ul><ul><ul><li>Required packages: </li></ul></ul><ul><ul><ul><li>commons-validator.jar </li></ul></ul></ul><ul><ul><ul><li>jakarta-oro.jar </li></ul></ul></ul><ul><li>Configuring the Validation Rules </li></ul><ul><ul><li>validation-rules.xml </li></ul></ul><ul><ul><li>validation.xml </li></ul></ul>
  17. 17. 8. Tiles Framework <ul><li>What is a Template? </li></ul><ul><ul><ul><li>A template is a JSP page that uses a JSP custom tag library to describe the layout of a page. The template acts as a definition for what the pages of an application will look like, without specifying the content. The content is inserted into the template page at runtime. One or more page may use the same template. </li></ul></ul></ul><ul><li>What is a Tile? </li></ul><ul><ul><ul><li>A tile is an area or region within a web page. </li></ul></ul></ul><ul><li>Using a layout Tile </li></ul><ul><ul><ul><li>Classic layout </li></ul></ul></ul><ul><ul><ul><li>Columns layout </li></ul></ul></ul><ul><ul><ul><li>Center layout </li></ul></ul></ul><ul><ul><ul><li>Menu layout </li></ul></ul></ul><ul><ul><ul><li>Tabs layout </li></ul></ul></ul><ul><ul><ul><li>Vertical box layout </li></ul></ul></ul>
  18. 18. 9. Summary
  19. 19. Thanks…

×