J2EE Programming

This course teaches programmers how to write enterprise applications based on the Java 2 Enterprise Edition (J2EE) architecture. In addition to the core concepts of J2EE, this course provides specific instruction on building J2EE applications using the best practices established in the field.

Upon completion of this course, you should be able to:

•The core concepts of J2EE: Servlets, Java Server Pages, Enterprise Java Beans
•How to develop and maintain J2EE applications
•How to deploy J2EE applications into an Application Server

Course Outline


1. Introduction to J2EE and the J2EE Application Server 1.4



  • Objectives

  • Java Web Applications

  • Java Web Application Architecture

  • J2EE Architecture

  • Web Application Programming Model – MVC

  • An MVC Example

  • The Infrastructure for Enterprise Web Applications

  • The J2EE 1.4 SDK

  • J2EE EAR File Structure

  • J2EE Application Server - Tools

  • Starting the J2EE Server

  • Stopping the J2EE Application Server

  • Starting the Admin console

  • Deploying Applications – Application Deployment Tool

  • The Verifier

  • PointBase database & Console

  • PointBase Console

  • Application Server Logs

  • Summary


2. Introduction to Eclipse IDE and Open Source Servers



  • Objectives

  • The Eclipse Platform

  • Eclipse 3.0 Java IDE

  • Views, Perspective and Editor Areas

  • Basic Operations with Eclipse Views and Perspectives

  • The Java Perspective

  • The Debug Perspective

  • Navigator View

  • Package Explorer

  • Outline View

  • Problems View

  • Tasks View

  • Build and Validation

  • Import and Export Project

  • Templates and Code Completion

  • Searching

  • Setup Compiler Class Path

  • JRE Switching

  • MyEclipse 3.8

  • MyEclipse - Visual HTML Designer

  • MyEclipse – JSP Development

  • MyEclipse – EJB Support

  • MyEclipse – Struts Modeler

  • MyEclipse – XML Editor

  • MyEclipse – Application Connector

  • Summary


3. 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 Servlet Container

  • The Servlet API

  • Life Cycle – Initialization

  • Example Initialization

  • Life Cycle – Processing

  • Life Cycle – Destroy

  • User Input

  • Example – User Input

  • Output to Client

  • Servlet Error Handling

  • Threading Issues

  • 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 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 Comments

  • JSP Predefined Variables

  • The request Object

  • The response Object

  • The out Object

  • Out – an Example

  • J2EE Deploytool

  • Summary


5. JSTL & EL



  • Objectives

  • JSTL – what does it provide?

  • Core JSTL Tags

  • Core JSTL Tags- continued

  • Formatting tags

  • I18N tags

  • More formatting

  • Database tags

  • Database Tags - continued

  • XML Tags

  • The JSTL Expression Language

  • JSTL EL

  • JSTL Opeartors

  • JSTL Implicit objects

  • Expression Language

  • Need for EL

  • EL & JSPs

  • Expression Language - Syntax

  • Literals

  • Operators

  • Operator Precedence

  • Variables

  • Implicit Objects

  • Functions

  • Defining Functions

  • Declaring Functions

  • Functions


6. 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…

  • Session Details

  • URL Rewriting

  • Summary


7. Servlet Programming – Advanced



  • Objectives

  • Key Issues for Web Application Development Productivity

  • Web Application Programming Model – MVC

  • Model

  • View

  • Controller

  • What is JDBC?

  • JDBC Architecture

  • JDBC: Basic Steps

  • Loading a Driver

  • DB2 UDB JDBC Drivers

  • Create a Connection

  • Connection

  • Statement

  • PreparedStatement

  • 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

  • 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


8. JSP Programming Techniques



  • Objectives

  • Error Handling

  • Example Exception Handling

  • Using an Error Page

  • Form Validation – Client Side

  • Form Validation – Server Side

  • Session Tracking


9. 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


10. 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

  • 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


11. Session Bean



  • Objectives

  • Session Beans

  • Stateless Session Bean

  • Stateful Session Bean

  • Components of Session Beans

  • Home Interfaces

  • Remote interface

  • Local interface

  • The Session Bean Class

  • ejbCreate() Method

  • Business Methods

  • A Simple Stateless Session Bean Example

  • A Simple Stateful Session Bean Example

  • Session Context

  • EJB Context

  • EJB Context…

  • Session Bean Lifecycle

  • Lifecycle - Stateless

  • Lifecycle - Stateful

  • Lifecycle – Stateful

  • Lifecycle - Stateful

  • Concurrency Issues

  • Invoking Session Beans from client Application

  • Looking Up a Home Object

  • Looking Up a Local Home Object

  • Create an EJB Object

  • Calling business methods

  • Summary


12. Entity Beans



  • Objectives

  • Entity Beans

  • Entity Bean Components

  • Container

  • Container…

  • Primary Key Class

  • A Primary Key Class Example

  • (Remote) Home Interface

  • (Remote) Home Interface…

  • Local Home Interface

  • Remote Interface

  • Local Interface

  • Entity Bean Class

  • Entity Instance

  • Entity Object Lifecycle

  • Bean Instance Lifecycle

  • Bean Instance Lifecycle…

  • Persistence

  • Bean Managed Persistence

  • Container Managed Persistence

  • Writing BMP Bean

  • Writing BMP Bean…

  • A BMP Bean Example

  • A BMP Bean Example…

  • Writing a CMP Bean

  • Writing a CMP Bean…

  • Indicating Persistent Fields

  • EJB Query Language

  • EJBQL: Simple examples

  • EJBQL: SELECT clause

  • EJBQL: SELECT clause…

  • EJBQL: FROM clause

  • EJBQL: WHERE clause

  • EJBQL: WHERE clause…

  • EJBQL: Watch out!

  • Using EJBQL in a CMP bean

  • Business Methods

  • EntityContext

  • Writing CMP Beans

  • Defining and Mapping CMP Fields

  • A CMP Entity Bean Example

  • Summary


13. Best Practices



  • Objectives

  • Remove Stateful Session Beans

  • Reduce the Transaction Isolation Level where possible

  • Access Entity Beans from Session Bean

  • Reuse EJB Homes

  • Avoid two-phase commit if possible

  • Avoid transactions for non-transactional methods

  • Avoid Stateful Session EJBs

  • CMP Pooling

  • Do not store large Object Graphs in HttpSession

  • Release HTTP Sessions

  • Use JDBC Connection Pooling

  • Release JDBC Resources

  • Avoid String Concatenations

  • Minimize Synchronization


14. J2EE Design Patterns



  • EJB Design Patterns

  • Types of EJB patterns

  • Session Façade Pattern

  • Session Façade

  • Session Facade

  • Session façade pattern shortcomings

  • Message Façade Pattern

  • Message Façade

  • Message façade pattern shortcomings

  • EJB Command pattern

  • EJB Command

  • EJB Command pattern shortcomings

  • Generic Attribute Access pattern

  • Generic Attribute Access

  • Data Transfer Object (DTO)

  • Data Transfer Rowset

  • Version Number pattern

  • Version Number Pattern

  • Fast Lane Pattern

  • Data Access Command Beans

  • EJBHomeFactory

  • Business Delegate

  • Sequence Blocks

  • Stored Procedures for Autogenerated Keys

  • Summary


15. Message-Driven Beans



  • Objectives

  • The Trouble with RMI/IIOP

  • Messaging to the Rescue

  • Messaging Features

  • Message-Oriented Middleware

  • Messaging Domains

  • Publish/Subscribe

  • Point-to-Point

  • Java Message Service

  • JMS Programming: Overview

  • JMS Programming: Overview…

  • The JMS Interfaces

  • JMS Programming: Example

  • JMS Programming: Example…

  • Integrating JMS and EJB

  • Message-Driven Beans Are Different From Other EJBs

  • Message-Driven Beans Cannot Talk to Their Clients

  • Message-Driven Beans are Stateless

  • Durable Subscription

  • Message-Driven Bean Interfaces

  • javax.ejb.MessageDrivenBean

  • javax.jms.MessageListener

  • javax.jms.Message

  • Lifecycle

  • Example: Message Counter

  • Class MessageCounter

  • Class MessageCounter…

  • Processing the Message

  • Deployment Descriptor Entry

  • Binding the Queue or Topic

  • Transactions

  • Security

  • Load Balancing

  • Clustering and Topics

  • Clustering and Queues

  • A Few Tips

  • Poison Messages

  • How the Programmer Can Avoid Poison Messages

  • How the System Administrator Can Avoid Poison Messages

  • Building a Response

  • Potential Problems

  • A Simple Alternative

  • Type Checking and Messages

  • Testing Message-Driven Beans

  • Summary

  • References


16. Custom Tag Libraries



  • Objectives

  • The taglib directive

  • Components of a tag library

  • Tag Library Descriptor

  • Tag Handler Class

  • Tag handler life cycle

  • The Java Server Page

  • Example: Car Price

  • Tag Library Descriptor Details

  • carPrice.tld

  • Tag Handler class

  • CarPriceHandler

  • CarPriceHandler…

  • carPrice.jsp

  • Packaging a Tag Library Within the Web Application


· The Struts Tag Library Struts Bean Tags

  • Handling Tag Bodies

  • Example: Body Tag Support

  • Summary


17. Collections



  • Collections

  • Vector

  • Linked List

  • Array List

  • Hash Set

  • Tree Set

  • Map Class

  • Stack Class

  • Summary


Audience

This course is designed for Java programmers and web application designers who have interest in learning how to build or maintain enterprise applications based on the J2EE architecture.