WA1178 Building J2EE Applications using Struts 1.1 Training and Courseware Course Outline

1. Overview of Web Applications

  • Objectives
  • Tiered Architectures
  • Multi-Tier Distributed Application Framework of Web Applications
  • Presentation Layer
  • Middle Tier
  • Design Pattern of Web Applications JSP Model
  • Design Pattern of Web Applications MVC Model
  • An Example of MVC Model
  • Design Pattern of Web Applications MVC Model
  • Summary
 

2. Servlet Basics

  • Objectives
  • History CGI
  • Server Extension APIs
  • Java Servlet
  • Servlet Container
  • Servlet Responsibilities
  • J2EE and Servlet
  • The Servlet Class
  • An Example Hello World
  • The Web Container
  • The Servlet API
  • Life Cycle Initialization
  • Life Cycle Initialization
  • Example Initialization
  • Life Cycle Processing
  • Life Cycle Processing
  • Life Cycle Destroy
  • User Input
  • Example User Input
  • Output to Client
  • Servlet Error Handling
  • Threading Issues
  • Summary
 

3. Servlet Interaction Interface

  • Objectives
  • Request
  • Request Parameters
  • Request Attributes
  • Request Headers
  • Request Path
  • Other Request Information
  • Response
  • Cookies
  • Setting Cookies
  • Servlet Context
  • Servlet Context Attributes
  • Resource
  • Session Tracking
  • Tracking Techniques
  • Cookies
  • Cookies an Example
  • HTML Hidden Fields
  • URL Rewriting
  • Using HttpSession
  • Session Invalidation
  • An Example of Session Tracking Code...
  • An Example of Session Tracking Code
  • An Example of Session Tracking Code
  • An Example of Session Tracking Code
  • An Example of Session Tracking Code
  • An Example of Session Tracking Code
  • An Example of Session Tracking Code
  • Session Details
  • URL Rewriting
  • Summary
 

4. Java Server Page Basics

  • Objectives
  • JavaServer Pages
  • A Simple Example - Hello.jsp
  • JSP Benefits
  • Evolution of Dynamic Content Technologies
  • How JSP Works
  • JSP Invocation
  • JSP Scripting Elements
  • JSP Directive
  • page Directive Attributes
  • page Directive an Example
  • page Attribute errorPage
  • page Attribute isErrorPage
  • Directives include
  • Include an Example
  • Include an Example
  • Include at compile time vs. at request time
  • Request time inclusion
  • JSP Declarations
  • Declarations an Example
  • JSP Expressions
  • JSP Expressions an Example
  • JSP Scriptlets
  • JSP Scriptlets an Example
  • JSP Scriptlets an Example
  • JSP Comments
  • JSP Predefined Variables
  • The request Object
  • The response Object
  • The out Object
  • Out an Example
  • Summary
 

5. JSP Programming Techniques

  • Objectives
  • Error Handling
  • Example Exception Handling
  • Using an Error Page
  • Form Validation Client Side
  • Form Validation Client Side
  • Form Validation Client Side
  • Form Validation Server Side
  • Form Validation Server Side
  • Session Tracking
 

6. Servlet Programming Advanced

  • Objectives
  • Key Issues for Web Application Development Productivity
  • Web Application Programming Model MVC
  • Model
  • View
  • Controller
  • Java Beans
  • Web Applications
  • Request Dispatching
  • Request Dispatching - Forward vs. Include
  • HTTP Redirection
  • Dispatch vs. redirection
  • Integrating Servlet and JSP
  • Calling a JSP from a Servlet
  • Request Dispatching - forward Request to JSP
  • Supply Result information to the JSP
  • A Simple Example
  • What is JDBC?
  • JDBC Architecture
  • JDBC: Basic Steps
  • Loading a Driver
  • DB2 UDB JDBC Drivers
  • Create a Connection
  • Connection
  • Statement
  • PreparedStatement
  • ResultSet
  • ResultSet
  • ResultSet
  • Example JDBC Servlet With Transactions
  • Close the Connection
  • Need for Connection Pooling
  • Connection Pooling in JDBC 2.0
  • Connection Pooling
  • Basic Steps in Using JDBC Connection Pooling
  • Access a DataSource
  • Get a Connection
  • Release Connections
  • Connection Pool Example
  • Summary
 

7. Using Java Beans with JSP

  • Objectives
  • What is a JavaBean?
  • Structure of a JavaBean
  • Life Cycle
  • Properties
  • Very Simple Bean
  • Using Java Beans in JSP
  • The <jsp:useBean> tag
  • Java Bean scope
  • <jsp:useBean> in Action
  • The <jsp:getProperty> tag
  • The <jsp:setProperty> tag
  • Mapping all the request parameters
  • Another Example
  • Mixing Scriptlets and Bean tags
 

8. Enterprise JavaBeans Overview

  • Objectives
  • Needs for EJB
  • Distributed Computing
  • Distributed Transaction
  • Distributed Security
  • What are EJBs?
  • Main Characteristics of EJBs
  • EJB Technologies
  • CORBA Object Distribution
  • RMI over IIOP
  • EJB Architecture Components
  • EJB Client
  • EJB JAR File
  • EJB Server
  • EJB Container
  • EJB Container - Persistence
  • EJB Container - Transaction
  • Enterprise Java Beans
  • Message-Driven Beans are Different
  • Session Beans
  • Entity Beans
  • EJB Classes and Interfaces
  • Basic Components of Entity and Session Beans
  • EJB Home Interface
  • An EJB Home Interface Example
  • EJBHome Object
  • EJB Remote Interface
  • Remote Interface Example
  • EJB Local Home Interface
  • EJB Local Interface
  • Remote EJB Objects
  • Local EJB Objects
  • EJB Implementation Class
  • EJB Container - Relationships
  • EJB Container Relationships
  • How do (remote) EJBs Work
  • Remote v. Local EJBs
  • EJB Application Development
  • Deploying Enterprise Beans
  • Major Components of Deployed EJBs
  • Summary
 

9. Struts Architecture and Overview

  • Objectives
  • Review: MVC Model
  • Review: Request, Session and Application
  • What is Struts?
  • Struts Flow
  • Components in Struts
  • The Model
  • The View
  • The Controller
  • Struts Flow
  • struts-config.xml
  • struts-config.xml Content
  • The <data-sources> element in the struts-config.xml
  • The <form-beans> element in the struts-config.xml
  • The <global-forwards> element in the struts-config.xml
  • The <action-mappings> element in the struts-config.xml
  • Sample struts-config.xml
  • The Role of web.xml for the Application
  • Configuring Struts in the web.xml
  • web.xml Content
  • Steps to Configuring Struts in the web.xml
  • Step 1. Configuring the Action Servlet Instance in the web.xml
  • Action Servlet Config Example
  • Step 2. Configuring the Action Servlet Mapping in web.xml
  • Prefix Mapping Example
  • Extension Mapping Example
  • Step 3. Configuring the Struts Tag Libraries in the web.xml
  • Sample web.xml
  • Summary
 

10. The First Struts Application

  • Objectives
  • The application
  • The Structure
  • Setup Needed
  • Directory Structure
  • index.jsp
  • index.jsp - continued
  • The index.jsp Page
  • struts-config.xml
  • MultiplyForm.java
  • MultiplyForm.java - continued
  • MultiplyAction.java
  • MultiplyAction.java - continued
  • result.jsp
  • The result page
  • ApplicationResources.properties
  • Summary
 

11. Struts 1.1 Development using Tomcat

  • Objectives
  • Software s to be installed
  • Creating the directory structure of a Struts Application
  • The set-up needed for a Struts Application
  • The set-up needed for a Struts Application - continued
  • The build.xml file
  • The steps to deploy this application in Tomcat
  • How to deploy a change made in the same application
  • Run the application
  • Debugging apps in Tomcat
  • Summary
 

12. Struts Development Cycle

  • Objectives
  • Struts Development Cycle
  • Gathering Requirements
  • Defining Screen Requirements
  • Detailed screen design
  • Determining the Screen Flow
  • Defining the ActionMappings in the struts-config.xml
  • Struts view components Data vs. ActionForm Bean
  • Defining Screen Requirements define FormBean
  • Developing the FormBean
  • Developing the FormBean The reset( ) Method
  • Developing the FormBean The validate( ) Method
  • Developing the FormBean ActionErrors
  • Developing the FormBean Defining the Message Key
  • Developing the Action Class action and Action Class
  • Developing the Action Class
  • Developing Actions The execute() Method
  • Developing Actions ActionForward
  • Developing Actions ActionMapping class
  • Developing Actions execute() example
  • execute() Method Example:
  • Developing Business Logic EJBs
  • Developing JSPs
  • Configuring struts-config.xml and web.xml
  • Build, Pack, and Deploy
  • Summary
 

13. Struts Tag Libraries

  • Objectives
  • Struts Tag Libraries
  • Commonality among the Struts Tags
  • Bean Tags
  • Bean Tags
  • <bean:define>
  • <bean:define>...
  • <bean:message>
  • <bean:page>
  • <bean:include>
  • <bean:cookie>
  • <bean:resource>
  • <bean:write>
  • <bean:header>
  • <bean:parameter>
  • HTML Tags
  • <html:form>
  • <html:submit>
  • <html:text>
  • <html:password>
  • <html:link>
  • <html:errors>
  • <html:messages>
  • <html:messages>
  • <html:multibox>
  • <html:multibox>
  • <html:select>
  • <html:options>
  • Logic Tags
  • Logic Tags functionality
  • <logic:equal>
  • <logic:greaterEqual> and <logic:lessEqual>
  • <logic:lessThan> and <logic:notEqual>
  • <logic:notEmpty>
  • <logic:iterate>
  • Summary
 

14. Struts Extensions, Internationalization and Error Handling

  • Objectives
  • Struts Extensions
  • Extension Points
  • Plug-ins
  • A plug-in example
  • Custom Configuration Class
  • Writing a Configuration Class
  • Custom ActionServlet
  • Custom RequestProcessor
  • Base Action Class
  • Base Form Bean
  • Custom JSP Tags
  • Internationalization (I18N)
  • I18N - continued
  • Error Handling
  • The ActionError class
  • The ActionErrors class
  • Error Handling : validate() method of ActionForm
  • Displaying the errors found in the validate method
  • Error Handling : execute() method of Action
  • Error Handling : execute() method of Action - contd
  • Declarative Exception Handling
  • Syntax of declarative exception handling
  • Programmatic Exception Handling
  • Logging from Struts
  • Logging (cont.)
  • Using Commons Logging and Log4J in Struts
  • Writing Commons Logging Code
 

15. Miscellaneous Advanced Features

  • Advanced Features Discussed in This Chapter
  • Integration of Jakarta Common Libraries - BeanUtils
  • Integration of Jakarta Common Libraries - Digester
  • Multiple Sub-application Support
  • DynaActionForms
  • Validators
  • Adding the Validator framework to a Struts application
  • A tale of three files
  • A sample rule in the file validator-rules.xml
  • A rule in validator-rules.xml (continued)
  • validation.xml file
  • Validator Dependency
  • Rule Variables
  • Error Message
  • Error Message (cont.)
  • Basic Validation Rules
  • Client Side Validation
  • Validating multiplication example using DynaActionForm
  • Writing Custom Validators
  • Validator Class Example
  • HTTP Redirection
  • Working With Check Boxes
  • Context Sensitive Form Validation
 

16. Database Programming

  • Basic Concepts
  • MVC Interaction
  • Database Connection
  • Transaction Management
  • Data Source
  • Defining a Struts Data Source
  • Opening a Connection from a Struts Data Source
  • Creating an Editor Form
  • Example Form Display Action
 

17. Templates and Tiles

  • Objectives
  • Struts Templates
  • Defining the Template
  • A template
  • Using the template in a JSP
  • <template:insert>
  • <template:put>
  • A JSP that uses the template
  • Struts Templates
  • Templates as UI components
  • Struts 1.1 Tiles Support
  • Tiles
  • Tiles example
  • A JSP that uses the layout
  • Tiles go beyond templates
  • Inheritance in tiles definitions
  • Definitions as Struts forwards
  • Definitions as Struts forwards
  • Definitions as Struts forwards
  • Template or Tiles?
 

18. Unit Testing Struts Applications

  • Objectives
  • What is JUnit?
  • Why JUnit?
  • A JUnit Test
  • Running the tests
  • JUnit Basics
  • Unit Testing Struts Applications
  • A simple Struts test case
  • MockStrutsTestCase Methods
  • MockStrutsTestCase methods
  • Downloading STC
  • Testing Strategies
  • A batchfile to run STC
  • Directory Structure
  • Executing this application
 

19. JSP Expression Language and Standard Tag Library

  • JSP Expression Language (EL)
  • Basic Usage
  • Built-in Objects
  • Working With Arrays and Maps
  • Operators
  • Full Example
  • JSP Standard Tag Library (JSTL)
  • Run Time Version
  • Basic Tags
  • Condition Tags
  • Interator Tags
  • Internationalization (I18N)
  • Setting Preferred Locale
  • Specifying Resource Bundle
  • Display Translated Text
  • Display Number
  • Display Date
  • JDBC Tags
  • Specify Data Source
  • Performing a Query
  • Display Result
  • Pagination Example
 

Appendix A. Custom Tag Libraries

  • Introduction
  • Tag Attributes
  • Tag Body
  • Tag Library Descriptor
  • Tag Library Descriptor Details
  • carPrice.tld
  • The Java Server Page
  • Writing a Simple Tag Handler Class
  • Tag Handler Life Cycle
  • Rendering Content
  • Implementing Empty Body Tag
  • Example: CarPriceHandler
  • CarPriceHandler
  • carPrice.jsp
  • Implementing a Tag With Unprocessed Body
  • Handling Tag Bodies
  • Implementing Body Processing
  • Example: Body Tag Support
  • Implementing an Iteration Tag
  • Nested Tags
  • Summary