WEB APPLICATION PROGRAMMING WITH JAVA EE 6 – WEBSPHERE 8.0 / RAD 8.0 – GTWSP10

Course Description

This web programming training class will show participants how to easily create quality Java web applications using all of the features of JSF. Also covered is an overview of Servlet/JSP technology for web applications, using EJB for business logic, JPA for persistence, and the CDI specification for dependency injection.

Programming Java web applications has been greatly simplified with the JavaServer Faces (JSF) specification. With the introduction of the most recent JSF 2.0 version this has been expanded even further to include many advanced features and solve weaknesses of previous JSF versions. Web application programmers that utilize JSF as opposed to the “traditional” Servlet/JSP model can spend more time focusing on the functionality of the application and less on the raw programming required to parse and validate request data and share data between web components.

This course is also available using Eclipse IDE.

Objectives

This class combines lecture with hands-on experience, and open ended discussion that will help the developer quickly understand how to program web applications using Java EE 6. Upon completion of the course, students will:

  • Have an overview of the Servlet/JSP web technologies
  • Develop web based applications using JavaServer Faces
  • Develop business logic layer using EJB 3.1
  • Persist data using Java Persistence (JPA)
  • Use CDI (Contexts and Dependency Injection) to perform type-safe dependency injection of components
  • Use the JSF 2.0 integration with CDI including the CDI support of “conversational” web applications
  • Define standardized data validation constraints with JSR 303 Bean Validation

Topics

  • Servlet/JSP
  • Web applications using JavaServer Faces
  • Various JSF page components
  • Enterprise JavaBeans (EJB)
  • Java Persistence (JPA)
  • JSR 303 Bean Validation

^^

Duration

5 days

^^

Target Audience

Software designers, developers and programmers new to Java EE or with J2EE 1.4 or earlier experience

^^

Course Prerequisites

Participants should already have an understanding of Java programming. For those that require Java experience before this course the following course is suggested:

GTJ01 – Introduction to Java Using Eclipse

^^

Suggested Follow on Courses

There are a number of options of suitable follow-on courses, depending on your business needs. Please contact us for further details.

^^

Course Content

Chapter 1. Servlet Basics

History – CGI

Server Extension APIs

Java Servlet

Java EE and Servlet

New In Servlet 2.5

New In Servlet 3.0

Servlet Container

Servlet Responsibilities

The Servlet Class

The HttpServlet 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

Chapter 2. Servlet Interaction Interface

Request

Request Parameters

Request Attributes

Request Headers

Request Path

Other Request Information

Response

Cookies

Components of a Cookie

Issuing Cookies

Retrieving Cookies

Deleting a Cookie

Servlet Context

Servlet Context Attributes

Resource

Session Tracking

Tracking Techniques

HTML Hidden Fields

Using HttpSession

Session Invalidation

An Example of Session Tracking Code…

An Example of Session Tracking Code…

HttpSession – URL Rewriting

Chapter 3. JavaServer Page (JSP) Basics

JavaServer Pages

JavaServer Pages 2.1

A Simple Example – Hello.jsp

JSP Benefits

Evolution of Dynamic Content Technologies

How JSP Works

JSP Invocation

JSP Scripting Elements

The XML Syntax

JSP Directive

page Directive Attributes

page Directive – an Example

page Attribute – errorPage

page Attribute – isErrorPage

Using XML Syntax

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

Chapter 4. Introduction to JavaServer Faces 2.0

What is JavaServer Faces (JSF)?

Why Use JSF?

Nature of a JSF Application

JSF Implementations

JSF and MVC

Faces Servlet

Faces Servlet URL Mapping

Managed Bean

The View Layer

XML Validity of a Page

A Simple JSF Application

The Input Form: form.xhtml

The Result: thanks.xhtml

The Controller: AddressBean

How Does the Application Work?

Under the Covers: The Rendered Form HTML

Under the Covers: The Layout Tree

Additional References

Chapter 5. Basic JSF User Interface Components

JSF UI Components

JSF UI Tags

A Basic Page

Define a Form

Labels and Images

Button

Links

Output Link

Text Input

Simple Check Box

Check Box Group

Check Box Group Example

Radio Button

List Boxes

Multiple Selection List Box

Dynamic List Box

Example

Component Identifier

Showing and Hiding Components

Other Common Attributes

Adding JavaScript and Stylesheet

Chapter 6. Basic Managed Bean and JSF Expression and Scope

Introduction

JSF Expression Language (EL)

Simple Value Property

Complex Value Property

Method Expression

Managed Bean Scopes

Implications of Various Scopes

View Scoped Managed Beans

Defining Managed Bean Scope

Getting Rid of the Session

Application Scope

“None” Scope

Custom Scopes

Chapter 7. JSF Event Handling

Request Processing Phases

Action Request Processing Phases

JSF Event & Listener Model…

JSF Event Classes

Event Classes

Event Classes: Hierarchy

Action Event Handling

Action Event: Example

Action Listener

Passing Arguments

Value Change Event

Value Change Event Handler

Listener Classes

Listener Interfaces

Listener Classes: Hierarchy

Action Listener Class

Value Change Listener Class

Phase Event Listener

Request Processing Lifecycle

Phase Identifiers

 

Chapter 8. JSF Navigation

JSF Navigation

Example Action Event Handler

Implicit Navigation

Pros and Cons of Implicit Navigation

Defining Rules in faces-config.xml File

Stating the Source View ID

Stating the Action Handler Method

Global Rule

Doing Redirection

Implementing Redirection

Conditional Navigation

Preemptive Navigation

Chapter 9. Advanced JSF User Interface Components

HTML Panel

Applying Styles

Grouping Components

Data Table

Using a Data Table

Displaying a Header and Footer Row

Applying Styles

Adding Links to a Row

Handling Action

Chapter 10. Overview of Contexts and Dependency Injection

Once upon a time

What is CDI?

The JSRs

CDI Example

What Good is DI

Old Bean Scope

CDI Bean Scope

Other Advanced Features of CDI

CDI Implementation

Chapter 11. Defining CDI Beans

Requirements of Bean Classes

Bean Initialization Methods

beans.xml

Managed Bean Type

Using Beans with EL

Beans Have Default Names

Bean Scopes

EJBs in CDI

Chapter 12. JSF Integration, Scope and Context

CDI Beans in JSF

JSF Example

Introduction to Scopes

Normal and Pseudo- scopes

Declaring Scope of a Bean

Scope Boundaries

Instance Sharing

Conversation Scope

Use Cases of Conversation Scope

Starting and Ending Conversations

Propagating Conversations

How Dependent Scope Works

Forcing a Dependent Instance

 

Chapter 13. Advanced Managed Beans

@ManagedProperty Annotation

Value Binding

Property Data Conversion

Advanced Property Types

Component Binding

Predefined Objects

Chapter 14. JSR 303 Bean Validation

Validation in Applications

Using Validation

Built-in Validation Constraints

Using Constraints

Showing Error Messages in JSF

Custom Validation Messages

Externalizing Validation Messages

External Message Example

Defining Custom Constraints

Custom Constraint Example

Interface

Validator

Custom Constraint in JSF

Bootstrapping Validation

The Validator API

Validation Groups

Group Example

Using Bean Validation in JPA 2.x and JSF 2.x

Chapter 15. JSF GET Requests and View Parameters

Using GET Requests with JSF

POST-Redirect-GET (PRG) Pattern

Implementing PRG Pattern With JSF

Defining View Parameters

New <h:link> and <h:button> Tags

Passing Request Parameters

Passing Request Parameters from POST Action Methods

Causing Redirection

Using a PreRenderView Event

The Flash Object

Chapter 16. Overview of Enterprise JavaBeans (EJB)

What are EJBs?

Distributed Transaction

Distributed Security

Distributed Computing

Main Characteristics of EJBs

EJB Container

EJB Client

Annotations

Enterprise JavaBeans

Session Beans

Message-Driven Beans (MDBs)

Asynchronous Session EJBs

EJB Timers

EJB Lite

EJB Packaging

EJBs are Simple!

Chapter 17. Overview of Java Persistence API

Data Persistence

Java Persistence API

Entities

Session EJB vs JPA Entities

Entities

Persisting and Retrieving Data

Accessing Entities

EntityManager & Persistence Unit

Persistence Context

Entities – Example

persistence.xml – Hibernate Provider

persistence.xml – Open JPA Provider

persistence.xml – Toplink

Entity Instance Lifecycle

Creating EntityManager in Session EJB

Creating EntityManager in a Plain Java Class

Working With the EntityManager Interface

Transaction Basics

Chapter 18. Using AJAX with JSF

Integrated AJAX Support in JSF 2.0

Challenges of AJAX with JSF

AJAX Handling in JSF 2.0

AJAX Handling in JSF 2.0 (cont’d)

Request Lifecycle for AJAX Requests

JSF JavaScript API

New <f:ajax> Tag

Partial Page Rendering

Third Party JSF Libraries with AJAX

Component Libraries Available

Chapter 19. Facelet Templates

Page Templates

Define a Page Template

Define a Template Client

Run the Template Client

Server Side Include

Removing Portions of a Page

Looping

Chapter 20. Facelets Composite Components

Introduction

The Basics

Basic Structure of a Composite XHTML

Defining the Interface

Defining the Implementation

Using the Component

Parameterizing the Controller

Supplying a Controller

Chapter 21. Internationalization (I18N)

Internationalization

I18N

Locales

Default Locales

Resource Bundles

Updating faces-config.xml

Loading the Bundle

Display Localized Text

Example – Resource Bundles

Update faces-config.xml

JSP

View the JSP

Benefits

Parameterized Messages

Displaying Parameters

Parameterized Messages

^^

See more WebSphere courses