Developing Java Enterprise Applications

Developing Java™ Enterprise Applications Stephen Asbury Scott R. Weiner Wiley Computer Publishing John Wiley & Sons, Inc. NEW YORK • CHICHESTER • W...
Author: Cordelia Kelly
6 downloads 3 Views 3MB Size
Developing Java™ Enterprise Applications

Stephen Asbury Scott R. Weiner

Wiley Computer Publishing

John Wiley & Sons, Inc. NEW YORK • CHICHESTER • WEINHEIM • BRISBANE • SINGAPORE • TORONTO

Contents

Chapter T

Chapter 2

Chapter 3

Chapter 4

Chapter 5

An Introduction to Java Enterprise Development

1

Supporting Concepts Enterprise Technologies Creating an Enterprise Application with Java Summary

1 5 6 8

What Is JDBC?

9

Goals for JDBC JDBC Architecture Summary

11 13 16

Basic JDBC Programming

17

About the Sample Database JDBC Basics A Simple JDBC Example Connecting to a Data Source Examining a Data Source Accessing the Database Fetching Data Handling Data Putting It Together JDBC 2.0 Features Summary

17 19 22 24 32 38 41 49 54 67 69

What Is JNDI?

71

Terminology Goals for JNDI JNDI Architecture Summary

71 76 77 78

Using JNDI

79

Setup Requirements The Naming Package

80 81

iv

Developing Java Enterprise Applications The Directory Package Schema Exception Handling Summary

103 125 126 131

Chapter 6

What Are Servlets? Server-Side Programming Technologies Processing Forms with CGI Processing Forms with Servlets Other Server-Side Features Summary

133 133 134 138 143 146

Chapter 7

Programming Servlets A Basic Servlet HTTP Servlets Multithreaded Servlets Servlets and Applets Designing Servlets Running and Hosting Servlets Debugging Servlets Performance Tuning Summary

147 147 157 181 185 192 195 196 205 213

Chapter 8

A Servlet-Based Search Engine HTMLSearchServlet IndexManager SearchTester.html Summary

215 216 228 232 233

Chapter 9

What Is Server-Side Scripting? Web-Based Application Structure JavaServer Pages Summary

235 235 242 248

Chapter 10

Creating JavaServer Pages How JavaServer Pages Work Basic Java in a JSP Changing a Page's Servlet Class Definition Accessing Other Servlets Handling Interrupts A Preview of the New JSP Standard Summary

251 252 256 274 277 281 282 287

Chapter 11

A JavaServer Page Online Store How the Store Works The Main Page Category Pages The Shopping Cart Summary

289 289 291 295 302 312

Contents Chapter 12

Chapter 13

Chapter 14

Chapter 15

Chapter 16

Chapter 17

Chapter 18

Chapter 19

Overview of Distributed Objects

313

Distributed Computing Distributed Objects Summary

313 315 324

Introduction to Java RMI

325

What Is RMI? A Simple Client/Server Application Example with Bidirectional Messaging Class Loading Garbage Collection RMI and Firewalls Remote Object Activation Summary

326 335 341 348 351 353 354 359

A Network File-Locking Server

361

Local Shared Locks Global Locks Summary

362 373 380

What Are Enterprise JavaBeans?

381

Roles When to Use EJBs EJB and CORBA Future Enhancements Summary

384 387 390 391 391

Programming Enterprise JavaBeans

393

An Enterprise JavaBean's Environment Creating an Enterprise JavaBean Creating a Session Bean Creating an Entity Bean Metadata, Handles, and Exceptions Security and Enterprise JavaBeans Summary

394 400 408 429 445 448 449

Deploying Enterprise JavaBeans

451

The DeploymentDescriptor The Deployment Process Summary

452 455 456

Enterprise JavaBean Business Rules Engine

459

The Rules Engine Check Request Example Summary

460 476 487

What Are Messaging and the Java Messaging Service?

489

Java Messaging Service Summary

494 495

v

vi

Developing Java Enterprise Applications

Chapter 20

Programming with the Java Messaging Service MiniJMS: The Example Provider JMS Fundamentals Point-to-Point Messaging Publish-Subscribe Messaging with Topics Distributed Transactions and JMS Providers Summary

497 498 499 518 544 553 554

Chapter 21

A JMS-Based Alarm System Alarm Server AlarmConfig AlarmDaemon Summary

557 561 576 578 579

Chapter 22

Transactions, JTA, and JTS Transactions in Java Summary

581 585 586

Chapter 23

Using Transactions with Enterprise JavaBeans Transaction Options An Example for Testing Transactions Reentrant Beans Summary

587 587 593 603 603

Chapter 24

Architecture Review The Technologies Example Designs Guidelines Summary

605 605 608 612 615

Chapter 25

A Four-Tier Online Store Basic Design The Shopping Cart EJB JavaServer Pages and HTML Servlets Building and Running the Store Summary

617 618 621 636 642 671 672

Chapter 26

MiniJMS: A Java Messaging Service Provider Basic Design Client/Server Interface The Client Library The Server Building and Running MiniJMS Summary

675 676 676 680 725 757 757

Appendix A

JDBC Information

759

Appendix B

What's on the CD-ROM?

768

Index

771