Course Outline: Developing Web-Based Software Using EJB and JSP
(5 Days) with Hands-On Labs
Learning Objectives
Understand the role of Java Server Pages in Sun’s overall Java server architecture
Create interactive Web pages using Java Server Pages
Gain a basic knowledge of the Java Server Pages API
Understand the role of Enterprise JavaBeans in enterprise-level systems development, and its relationship to other J2EE technologies such as JSP, servlets, JMS, CORBA, and XML
Understand the EJB architecture: the role of the EJB container in mediating contact between the client and the bean, transaction control, authorization control, and the importance of object pooling
Understand the development cycle for beans: Java source code and compilation, XML deployment descriptors, EJB compilation and deployment, and use by an application server
Understand the role of entity beans, their lifecycle and interactions with the container
Develop and test BMP and CMP entity beans and understand the importance of each of the entity-bean methods in assisting the container in pooling
Understand the role of session beans, their lifecycle and interactions with the container
Develop and test stateless and stateful session beans and effectively manage passivation/activation cycles
Use the bean context interfaces to assist with persistence code and to correctly establish bean-to-bean communication
Understand the EJB security architecture and apply roles and authorization attributes to EJB systems
Understand the EJB transaction architecture and apply transaction attributes to EJB systems
Understand and apply design patterns that are important to common distributed systems and EJB systems in particular
Tune EJB designs and code for best performance
This course description should be used to determine whether the course is appropriate for you based on your current skill and technical training needs. Technical information is provided on the intended audience, course prerequisites, and covered topics. Course content, prices, and availability are subject to change without notice.
Course Audience
This course is designed for seasoned Java developers who have been using the Java prgramming language for at least six months in a production environment.
Course Description
This one-week course empowers the experienced Java programmer to develop first-class multi-tier software for the World Wide Web. The primary technologies presented are Enterprise JavaBeans and Java Server Pages, with some peripheral coverage of other Java Enterprise topics such as JDBC, servlets, JNDI, and XML. By the end of the week, students will have seen demonstrations of one fairly simple end-to-end web-based system, and will have built their own end-to-end solution to a more complex problem. Demos and labs for the course are built for deployment to the J2EE reference implementation server, available free from Sun Microsystems and JavaSoft; portable implementation is emphasized, however, and deployment to commercial tools is discussed.
The course begins with a module introducing Java Server Pages (JSPs) as a simple and effective solution to the problem of providing interactive software to be hosted by a web browser. There is a short primer on the evolution of the WWW, the HTTP protocol, and the common issues encountered in trying to build web-based systems. For background and contrast, older and currently competing technologies such as CGI, ISAPI, and ASP are covered. Then the Java servlet architecture is introduced and briefly demonstrated. Students then learn how to build and deploy simple JSPs, and work at integrating HTML forms with JSP processing to develop truly interactive and effective web presentations.
The course proceeds to cover back-end development using the Enterprise JavaBeans architecture. The fundamentals of the EJB architecture are treated, and EJB is considered in the broader context of the full J2EE platform. Having understood JSP presentation, the students now start from the back end of a typical three-tier system, working first with entity beans. Both Bean-Managed Persistence (BMP) and Container-Managed Persistence (CMP) are covered and used in demos and labs. Then session beans (stateful and stateless) are discussed, and students at this point will complete the implementation of a full 3-tier system using JSPs, session and entity beans, and relational databases as supported by the Cloudscape RDBMS (available as part of the J2EE SDK download).
The final module of the course develops students’ knowledge of EJB, and of multi-tier Java systems development in general, with discussions of some advanced enterprise features and of best-practice development using EJB. A chapter each is spent on EJB’s support for security and transactions. The security implementations in demo and lab reach from the JSPs back to the entity beans, allowing students to build browser-based authentication and EJB-supported authorization policies into their software. Transactions as managed by the EJB container and as controlled programmatically in session beans are considered. The last chapter offers a discussion of best-practice development, considering several common distributed software patterns as applied to EJB/JSP systems and looking in particular at designing multi-tier systems for best performance over networks.
Course Objectives
At course completion the student will be able to perform the following tasks:
Understand the role of Java Server Pages in Sun’s overall Java server architecture
Create interactive Web pages using Java Server Pages
Gain a basic knowledge of the Java Server Pages API
Understand the role of Enterprise JavaBeans in enterprise-level systems development, and its relationship to other J2EE technologies such as JSP, servlets, JMS, CORBA, and XML
Understand the EJB architecture: the role of the EJB container in mediating contact between the client and the bean, transaction control, authorization control, and the importance of object pooling
Understand the development cycle for beans: Java source code and compilation, XML deployment descriptors, EJB compilation and deployment, and use by an application server
Understand the role of entity beans, their lifecycle and interactions with the container
Develop and test BMP and CMP entity beans and understand the importance of each of the entity-bean methods in assisting the container in pooling
Understand the role of session beans, their lifecycle and interactions with the container
Develop and test stateless and stateful session beans and effectively manage passivation/activation cycles
Use the bean context interfaces to assist with persistence code and to correctly establish bean-to-bean communication
Understand the EJB security architecture and apply roles and authorization attributes to EJB systems
Understand the EJB transaction architecture and apply transaction attributes to EJB systems
Understand and apply design patterns that are important to common distributed systems and EJB systems in particular
Tune EJB designs and code for best performance
Prerequisites
Solid Java programming experience is a must, especially for the EJB work. Our Java Programming course is good preparation for this course. Some understanding of HTML, XML, and the WWW is helpful but not required.
TOPICS COVERED IN LECTURE & LAB
Module 1: Introduction to Java Server Pages
Web Server Fundamentals
HTML and HTTP
CGI
ISAPI and Active Server Pages
Servlets
Java Server Pages
Using JavaServer Web Development Kit (JSWDK)
A Simple Java Server Page
JSP Architecture
How JSPs Are Processed
JSP Tags
XML Notation
Directives
Scripting Elements
Implicit Objects
Interactive JSP Applications
HTML Forms
Request-Response
Exceptions
Session Management
A Simple E-Commerce Site
Module 2: Introduction to Enterprise JavaBeans
The EJB Architecture
EJB and the Java Enterprise Platform
Common Enterprise Requirements
Role of the Application Server
The EJB Container
Persistence Architecture – Entity Beans
Object Pooling
Session Architecture – Session Beans
Transactions
Security
EJB Development
Remote Interface
Home Interface
Bean Class and Echoes of the Remote and Home Interfaces
Primary Key Class
Deployment Descriptor
EJB Environment
Build and Deployment Process
Home Object
EJB Object
Entity Beans
Instance versus Incarnation – Similarities to the CORBA PSS
Objects as Incarnations
EntityBean Interface and Responsibilities
Primary Keys
Object Pooling
EntityContext Interface and Discovering the Primary Key
Creation and Removal
Load and Store
Finder Methods
Bean-Managed Persistence
Finding a Data Source
Working to a Relational Database
Non-Relational Data Sources
Bean Environment – Declaring Resource References
Creation and Removal – INSERT and DELETE
Returning Primary Keys and Home Object Translation
Load and Store – SELECT and UPDATE
Finder Methods – more SELECTing
Container-Managed Persistence
Declarative versus Programmatic
Declaring a Data Source
What the Container Does
1.1 Architecture
2.0 Architecture
CMP Limitations
O/R Mapping Tools
Session Beans
Representing the Client
Session Management and Conversational State
Stateless Session Beans
Finding Entity Beans
Bean Environment – Declaring EJB References
Bean-to-Bean Communication
Stateful Session Beans
Object Pooling and Passivation/Activation
Module 3: Effective Enterprise JavaBeans
EJB Security
The Need for Security
Authentication
Authorization Model
Declarative Authorization and Roles
Abstract Roles and Application Assembly
Actual Roles and Deployment
Programmatic Authorization
Identifying the Caller
EJB Transactions
The Need for Transactions
ACID Properties
Declarative Transactions
Transaction Attributes and Isolation Levels
Scenarios
Programmatic Transactions
EJB Context and Monitoring the Transaction
SessionSynchronization Interface
Design Patterns and Development Techniques
The Bean Environment
Creation and Finder Semantics
Common Transaction Models
Designing for Latency
Serializable Records
When Not to Use EJB
Flyweights versus EJB Pooling
Entity Bean Optimizations Appendix A. References
System Requirements
This module requires the J2EE version 1.2.1. Use of the J2SE version 1.3 is recommended but 1.2 will work. Full documentation for both platforms is highly recommended. No IDEs are used in the demos and labs, but students may supply their own; course setup instructions include directions for downloading and installing TextPad 4.1 evaluation for the duration of the class.
A graphical web browser is needed to demonstrate and test code – any recent version of Netscape or Explorer will be fine. Netscape Navigator 4.7 is used in the book and demonstrations, so this would be an excellent choice.