session 03 struts framework presentation v1.0

Upload: richa-sharma

Post on 09-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    1/24

    2007, Cognizant Technology Solutions. All Rights Reserved.The information contained herein is subject to change without notice.

    C3: Protected

    Struts Framework

    Targeted at: Entry Level Trainees

    Session 03: Configuring Struts Application

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    2/24

    22

    About the Author

    Created By: Santhosh Perumal (126073)

    Baskar Senguttuvan (136303)

    Credential

    Information:

    Baskar - PMP, SEI Architect

    Santhosh - SCJP, SCWCD, SCBCD Certified Professional

    Version andDate:

    STRUTS/PPT/0508/1.0

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    3/24

    33

    Icons Used

    Questions

    Contacts

    Reference

    TryitOut

    HandsonExercise

    CodingStandards

    TestYourUnderstanding

    Tools

    AWelcomeBreak

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    4/24

    44

    Struts Framework Session 03:Overview

    Introduction:

    This session provides a brief overview about packaging

    and deploying Web applications.

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    5/24

    55

    Struts Framework Session 03:Objective

    Objective:

    After completing this session, you will be able to:

    Define Web Application

    Identify elements of a Web Application

    Describe the Web application directory structure

    Explain the Web-INF directory

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    6/2466

    What is a Web Application?

    A Web application is a collection of individual

    components that once bound together, form acomplete application which can be installed

    and executed by a Web container.

    The Web application should have a unique

    context name, which is used to identify the

    Web application inside the Web container.

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    7/2477

    What is a Web Application? (Contd.)

    The Web Application should have a

    configuration file called Deployment Descriptor

    named Web.xml. It contains the information

    needed by the servlet container in order to run

    the Web application such as servletdeclarations and mappings properties,

    authorization and security constraints, and so

    on.

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    8/248

    Elements of a Web Application

    All Web applications do not contains the same

    types of resources. In general, however Web

    applications can consist one or more of thefollowing types of components:

    Servlets

    JSP pages

    Standard JavaBeans and utility classes

    HTML documents

    Multimedia files (images, audio, and video files.)

    Client-side applets, style sheets, and JavaScript files

    Text documents

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    9/2499

    The Web Application DirectoryStructure

    The resources of a Web

    application are kept in a

    structured hierarchy of

    directories.

    The directory structure is well

    defined in terms of the

    placement of the resources and

    files. Figure shows animaginary Web application

    named HelloApp.

    Src: Contains java source files.

    WebContent: It is the Webmodule folder. It contains all

    Web components like jsp, html,

    and javascript files.

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    10/2410

    Understanding the Web-INF Directory

    Every Web application must have a Web-INF directory

    under its root directory.

    Although it is physically located inside the document

    root directory, it is not considered a part of thedocument root. All files in the Web-INF directory are not

    served to the clients.

    This directory contains three things: Classes directory:

    The servlet class files and the class files needed to support the

    servlets or JSP pages of this Web application go in this

    directory , if they have not been included in a JAR file.

    The class files should be organized according to their

    packages. At runtime, the servlet container adds this directory

    to the class path for this Web application.

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    11/2411

    Understanding the Web-INF Directory(Contd.)

    lib directory:

    All the JAR/zip files used by the Web application,

    including the third-party JAR/zip files, go in thisdirectory. For example, if a servlet uses JDBC to

    connect to a database, the JDBC driver JAR file

    should go here.

    You can also package the servlet classes in a JAR file

    and keep that file in this directory.

    At runtime, the servlet container adds all the JAR/zip

    files from this directory to the class path for this Web

    application.

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    12/2412

    Understanding the Web-INF Directory(Contd.)

    Web.xml file (Also known as the deployment

    descriptor):

    This file is the heart of a Web application, and every

    Web application must have it.

    It contains the information needed by the servletcontainer in order to run the Web application, such

    as servlet declarations and mappings, properties,

    authorization and security constraints, and so on.

    To ensure portability across the servlet containers,

    the DTD for this XML file is standardized by Sun.

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    13/241313

    Q & A

    Allow time for questions from participants

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    14/241414

    Try it Out

    Create a Dynamic Web application using SDE.

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    15/241515

    Try it Out (Contd.)

    Step 01: Create a new Project

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    16/2416

    Try it Out (Contd.)

    Step 02: Choose Dynamic Web project

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    17/2417

    Try it Out (Contd.)

    Step 03: Enter the project name: HelloApp

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    18/2418

    Try it Out (Contd.)

    Step 04: Enter content directoryname as WebContentand java source as src name. Click Fin ish .

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    19/24

    19

    Try it Out (Contd.)

    Output:

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    20/24

    2020

    Tools

    1. SDE 3.0 or above

    Tools

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    21/24

    2121

    Test Your Understanding

    1. What is a Web application?

    2. What is the directory structure of the Web

    application?

    3. What is the use of deployment descriptor in

    Web application?

    4. What is the use of Web-INF folder in Web

    application?

    k

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    22/24

    2222

    Struts Framework Session 03:Summary

    A Web application is a collection of individual

    components like jsp, html, JavaScript, and so

    on. The Web Application should have a

    configuration file called Deployment Descriptor

    named as Web.xml.

    Every Web application must have a Web-INF

    directory directly under its root directory. Web-INF directory should have lib, classes,

    and Web.xml file.

    S k S i 03

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    23/24

    2323

    Struts Framework Session 03:Source

    Programming Jakarta Struts, 2nd Edition

    Disclaimer: Parts of the content of this course is based on the materials available from the Web sites andbooks listed above. The materials that can be accessed from linked sites are not maintained byCognizant Academy and we are not responsible for the contents thereof. All trademarks, service marks,and trade names in this course are the marks of the respective owner(s).

  • 8/8/2019 Session 03 Struts Framework Presentation v1.0

    24/24

    2007, Cognizant Technology Solutions. All Rights Reserved.The information contained herein is subject to change without notice.

    You have completed theSession 03 of

    Struts Framework.