Professional Documents
Culture Documents
use only
Oracle Fusion Middleware 11g:
Build Java EE Applications
D53942GC10
Edition 1.0
January 2009
D57568
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Authors Copyright © 2009, Oracle. All rights reserved.
Gary Williams This document contains proprietary information and is protected by copyright and
other intellectual property laws. You may copy and print this document solely for your
own use in an Oracle training course. The document may not be modified or altered in
Technical Contributors any way. Except where your use constitutes "fair use" under copyright law, you may
and Reviewers not use, share, download, upload, copy, print, display, perform, reproduce, publish,
license, post, transmit, or distribute this document in whole or in part without the
Ken Cooper express authorization of Oracle.
Joe Greenwald
The information contained in this document is subject to change without notice. If you
Taj-ul Islam find any problems in the document, please report them in writing to: Oracle University,
500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not
Pete Laseau warranted to be error-free.
Adam Leftik
Restricted Rights Notice
Mike Lehmann
Editors
Aju Kumar
Amitha Narayan
Graphic Designer
Priya Saxena
Publishers
Sujatha Nagendra
Joseph Fernandez
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Contents
1 Introduction
Objectives 1-2
Course Objectives 1-3
Course Agenda 1-4
Fundamentals of Java EE Technology 1-9
iii
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Types of Enterprise JavaBeans 3.0 2-17
Enterprise JavaBeans 3.0 Component Architecture 2-18
Java Persistence API (JPA) 2-19
Quiz 2-21
Web Services 2-22
Java EE Web Services Architecture 2-23
Client-Tier Components 2-25
Java EE Web-Tier Components 2-26
Java EE Web Application Architecture 2-28
What Is a Servlet? 2-29
iv
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
The View 3-10
The Controller 3-11
Designing a Java EE Application 3-12
Quiz 3-13
Struts: Overview 3-14
Struts Components 3-15
Struts Architecture 3-16
Struts Page Flow Design 3-17
JSF and Struts 3-19
Implementing the User Interface with JSF and Core Java EE Patterns 3-20
v
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Error Handling 4-20
Debugging a Servlet 4-21
JDeveloper Environment 4-22
Servlet Mapping 4-23
Servlet Mapping in JDeveloper 4-24
Invoking a Servlet 4-25
Specifying Java EE Web Module Settings 4-26
Summary 4-27
Practice: Overview 4-28
vi
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Tag Library Descriptor 5-38
Implementing Simple Tags 5-39
JSP Expression Language 5-40
Expression Language Implicit Objects 5-41
JDeveloper and JSPs 5-42
Summary 5-43
Practice: Overview 5-44
vii
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Life Cycle of a Stateful Session Bean 7-12
Passivation and Activation Concepts 7-14
Creating a Stateful Session Bean 7-15
Defining the Stateful Session Bean 7-16
Analyzing the Remote and Local Interfaces 7-17
Creating a Test Client for the SFSB 7-18
Calling a Stateless Bean from a Stateful Bean by Implementing DI 7-19
Interceptor Methods and Classes 7-20
Interceptor Method 7-21
Interceptor Classes 7-22
viii
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Accessing an EntityManager Instance in an Application 9-7
Creating a Container-Managed EntityManager Instance 9-8
Creating an Application-Managed EntityManager Instance 9-9
Specifying Database Operations with the EntityManager API 9-10
Commonly Used Methods in the EntityManager Interface 9-11
Quiz 9-13
Inserting New Data 9-14
Deleting Data 9-15
Updating and Synchronizing the Entity with the Database 9-16
Updating Data 9-17
ix
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Creating the WSDL Document 10-23
Modifying the WSDL Document 10-25
Creating the Web Service by Using Oracle JDeveloper 11g 10-26
Implementing the Web Service Logic 10-27
Summary 10-28
Practice: Overview 10-29
x
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Summary 11-39
Practice: Overview 11-40
xi
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Event and Listener Execution Order 13-12
Validation in the JSF Life Cycle 13-13
Creating Custom Exception Handlers 13-15
Registering an Exception Handler 13-16
Changing Life Cycle Exception Reporting 13-17
JavaServer Faces Validators 13-18
Creating Backing Bean Validation in JDeveloper 13-19
Backing Bean Validator: Code Example 13-20
Input Validation 13-21
Summary 13-22
xii
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Types of Transactions 15-5
Transaction Management 15-7
Two-Phase Commit Protocol 15-8
Successful Two-Phase Commit 15-9
Unsuccessful Two-Phase Commit 15-10
Quiz 15-11
Java Transaction API (JTA) 15-12
EJB Transaction Model 15-13
Managing Transactions with EJBs 15-14
Types of Transaction Management 15-16
xiii
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Configuring New Users in WebLogic Server 16-14
Adding Users to Groups 16-16
Logical Roles 16-17
Quiz 16-19
Configuring Security 16-20
Determining Protected Resources 16-21
Defining the Logical Roles 16-22
Defining and Using Logical Roles in Web Applications (web.xml) 16-23
Defining and Using Logical Roles in EJBs (ejb-jar.xml) 16-24
Mapping Logical Roles to Users and Groups 16-25
xiv
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Deploying with the Oracle WebLogic Server Console 17-23
Deploying with Oracle JDeveloper 17-24
What Is Ant? 17-25
Ant Build Files 17-26
A Sample build.xml File 17-27
Creating a JAR File by Using Ant Task 17-28
Creating a WAR File by Using Ant Task 17-29
Creating an EAR File by Using Ant Task 17-30
Deploying an Application by Using Ant Task 17-31
Packaging Best Practices for Production Environments 17-32
18 Troubleshooting
Objectives 18-2
Troubleshooting Basics 18-3
Diagnosing the Problem 18-4
Requesting Help 18-5
Creating Test Cases 18-6
Java Logging 18-7
Configuring Java Logging 18-8
Sending Logger Output to a File 18-9
Turning on Diagnostics in JDeveloper 18-10
Sample Java Clients 18-11
Sample Client for Web Service 18-12
Tools and Utilities 18-13
Identifying Search Paths with FileMon 18-14
Testing Java Code with JUnit 18-15
Analyzing HTTP Requests 18-16
Debugging with JDeveloper 18-17
Summary 18-18
xv
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Printing Layout Panel Content B-9
Creating Collapsible Panes with the Panel Splitter Component B-10
Creating Collapsible Panes with the Panel Accordion B-11
Panel Accordion Overflow B-13
Setting Panel Accordion Properties B-14
Arranging Items in Columns or Grids B-15
Creating Stacked Tabs B-17
Hiding and Displaying Groups of Content B-18
Arranging Items Horizontally or Vertically, with Scrollbars B-20
Displaying Table Menus, Toolbars, and Status Bars B-22
Index
xvi
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED