• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Struts2 course chapter 2: installation and configuration
 

Struts2 course chapter 2: installation and configuration

on

  • 6,384 views

Struts2 course chapter 2: installation and configuration

Struts2 course chapter 2: installation and configuration

Statistics

Views

Total Views
6,384
Views on SlideShare
6,031
Embed Views
353

Actions

Likes
7
Downloads
1
Comments
1

7 Embeds 353

http://www.jeetrainers.com 302
http://jeetrainers.com 27
http://www.slideshare.net 13
http://static.slidesharecdn.com 5
http://localhost:8080 4
http://translate.googleusercontent.com 1
http://localhost 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Nice one
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Struts2 course chapter 2: installation and configuration Struts2 course chapter 2: installation and configuration Presentation Transcript

    • Chaper 2 Struts2 Course Installing and configuring Struts2 & Struts2 Architecture
    • Struts2 course topics
      • Chapter 1: Evolution of web applications
      • Chapter 2: Struts2 Installation and configuration
      • Chapter 3: Actions and results
      • Chapter 4: OGNL - Object-Graph Navigation Language
      • Chapter 5: Form Tags
      • Chapter 6: Generic Tags
      • Chapter 7: type conversion
      • Chapter 8: Input validation
      • Chapter 9: Message Handling and Internationalization
      • Chapter 10: Model Driven and Prepare Interceptors
      • Chapter 11: The Persistence Layer
      • Chapter 12: File upload and File download
      • Chapter 13: Securing Struts2 applications in Tomcat
      • Chapter 14: Custom Interceptors
      • Chapter 15: Custom Result Types
      • Chapter 16: Preventing Double Submits
      • Chapter 17: The Execute and Wait Interceptor
      • Chapter 18: Decorating Struts2 with Tiles
      • Chapter 19: Decorating Struts2 with SiteMesh
      • Chapter 20: Zero Configuration
      • Chapter 21: AJAX
    • Installing and configuring Struts2
      • Agenda
      • Downloading Struts2
      • Installing in a web project
      • Creating the first struts2 application
      • Struts2 Architecture
    • Downloading Struts2
    • Downloading Struts2
      • Download from: http://struts.apache.org/download.cgi
    • Files
      • Release Notes
      • Full Distribution:
        • struts-2.1.6-all.zip (110mb)
      • Example Applications:
        • struts-2.1.6-apps.zip (34mb)
      • Essential Dependencies Only:
        • struts-2.1.6-lib.zip (11mb)
      • Documentation:
        • struts-2.1.6-docs.zip (60mb)
      • Source:
        • struts-2.1.6-src.zip (20mb)
    • Installing Struts2
    • Installing Struts2 in a web project Struts.xml is the file where struts is configured Copy the struts2 files into the folder: WEB-INF/lib
    • Creating the first struts2 application
    • Creating the first struts2 application
      • Checking the web.xml
      < filter > < filter-name > struts2 </ filter-name > < filter-class > org.apache .struts2.dispatcher.FilterDispatcher </ filter-class > </ filter > < filter-mapping > < filter-name > struts2 </ filter-name > < url-pattern > /* </ url-pattern > </ filter-mapping >
    • Creating the first struts2 application
      • Checking the file struts.xml
      Logical names Action clases JSPs < struts > < package name = &quot;app02a&quot; namespace = &quot;“ extends = &quot;struts-default&quot; > < action name = &quot; Product_input &quot; > < result > /jsp/Product.jsp </ result > </ action > < action name = &quot; Product_save” class = &quot; app02a.Product” > < result > /jsp/Details.jsp </ result > </ action > </ package > </ struts >
    • The file product.jsp
      • <%@ taglib prefix = &quot;s&quot; uri = &quot;/struts-tags&quot; %>
      • < html >
      • < head >
        • < title > Add Product Form </ title >
        • < style type = &quot;text/css&quot; >
        • @import url(css/main.css) ;
        • </ style >
      • </ head >
      • < body >
        • < div id = &quot;global&quot; >
          • < h3 > Add a product </ h3 >
          • < s:form action = &quot;Product_save&quot; >
          • < s:textfield label = &quot;Product Name&quot; key = &quot;productName&quot; />
          • < s:textfield label = &quot;Description&quot; key = &quot;description&quot; />
          • <s:textfield label = &quot;Price&quot; key = &quot;price&quot; />
          • < s:submit />
          • </ s:form >
        • </ div >
      • </ body >
      • </ html >
      Properties of the action class
    • The file details.jsp
      • <%@ taglib prefix = &quot;s&quot; uri = &quot;/struts-tags&quot; %>
      • < html >
      • < head >
      • < title > Save Product </ title >
      • < style type = &quot;text/css&quot; > @imp o rt url(css/main.c s s); </ style >
      • </ head >
      • < body >
        • < div id = &quot;global&quot; >
          • < h4 > The product has been saved. </ h4 >
          • < p >
          • < h5 > Details: </ h5 >
          • Product Name: < s:property value = &quot;productName&quot; />< br />
          • Description: < s:property value = &quot;description&quot; />< br />
          • Price: $ < s:property value = &quot;price&quot; />
          • </ p >
        • </ div >
      • </ body >
      • </ html >
      Properties of the action class
    • The action class
      • public class Product implements Serializable {
        • private String productName ;
        • private String description ;
        • private String price ;
        • ...
        • public String execute () {
        • return &quot;success&quot; ;
        • }
      • }
    • Exercise 1
      • Example of MVC2 implementation using Struts2
        • struts2-02a
    • Exercise 1
      • Objective
      Note this
    • Exercise 1 Model View Controller
    • Resources To download example code for this chapter go to: http://www.jeetrainers.com http://struts.apache.org