Java Servlets Section 3.1... JSP Basics Application Section 5.2.. Basic Security Concepts Section 10.2.. A Look at Java and J2EE Security Standards Section 10.3... Other J2EE Security
Trang 2Java Enterprise in a Nutshell, 3rd Edition
Trang 3Computing Scenario
Trang 4Section 1.6 Other Enterprise APIs
Chapter 2 Application
Assembly and Deployment Section 2.1 J2EE Application Assembly Model
Chapter 3 Java Servlets
Section 3.1 Getting a Servlet
Trang 5Environment
Section 3.2 Servlet Basics Section 3.3 Web Applications Section 3.4 Servlet Requests Section 3.5 Servlet Responses Section 3.6 Custom Servlet Initialization
Section 3.7 Security
Section 3.8 Servlet Filters
Section 3.9 Thread Safety Section 3.10 Cookies
Section 3.11 Session Tracking Section 3.12 Databases and Non-HTML Content
Trang 6Chapter 4 JavaServer Pages Section 4.1 JSP Basics
Application
Section 5.2 Structure of a JSF Application
Trang 7Section 5.3 Managed Beans Section 5.4 The JSF
Trang 8Model Overview
Section 6.3 EJB Tutorial Section 6.4 Deploying EJBs Section 6.5 Using Enterprise JavaBeans
Section 6.6 Session Bean Specifics
Section 6.7 Entity Beans Section 6.8 Message-Driven Beans
Trang 10Section 8.5 Handling Errors Section 8.6 Prepared
Trang 11Section 9.2 A Simple Example Section 9.3 Introducing the Context
Trang 12Section 9.13 Event
Notification
Chapter 10 J2EE Security Section 10.1 Basic Security Concepts
Section 10.2 A Look at Java and J2EE Security Standards Section 10.3 Declarative
Trang 13Security Versus Programmatic Security
Section 10.4 Web Component Security
Section 10.5 EJB Component Security
Section 10.6 Other J2EE
Security Topics
Section 10.7 Limitations of J2EE Security
Chapter 11 Java Message
Service
Section 11.1 JMS in the J2EE Environment
Trang 14Chapter 12 Web Services with JAX-RPC and SAAJ
Trang 15Section 12.1 What's Covered Here?
Trang 16Section 13.1 What's Covered Here?
Section 13.2 Introduction to RMI
Section 13.3 Defining Remote Objects
Section 13.4 Creating the
Stubs and Skeletons
Trang 17Section 13.8 RMI and Native Method Calls
Section 13.9 RMI Over IIOP Chapter 14 Java IDL
Trang 18Using Remote Objects
Section 14.6 What If I Don't Have the Interface?
Trang 19Overview
Section 16.2 Programmatic Transactions Versus
Trang 20Section 17.4 Core Tasks
Section 17.5 Enterprise Tasks Section 17.6 Creating Portable Build Processes
Chapter 18 JUnit and Cactus Section 18.1 What's Covered Here?
Section 18.2 Unit Testing
Trang 21Concepts
Section 18.3 JUnit Overview Section 18.4 Using JUnit with Ant
Trang 22Section 19.8 Struts Plug-ins Section 19.9
DynaActionForms and the
Trang 23Hibernate
Section 20.3 Configuration and Mapping
Section 20.4 The Hibernate API
Section 20.5 HQL (Hibernate Query Language)
Trang 24Section 21.2 What Are Code Annotations?
Section 21.3 Annotation Tools Section 21.4 XDoclet Tutorial Section 21.5 J2SE Annotations Tutorial
Part III: Appendixes
Trang 25Section A.3 Application
Archives (application xml) Section A.4 Web Services (webservices.xml)
Section A.5 Web Service
JavaBeans Query Language Syntax
Section C.1 Basic Structure of
Trang 26EJB QL Queries
Section C.2 FROM Clause Section C.3 SELECT Clause Section C.4 WHERE Clause Section C.5 ORDER BY Clause
Appendix D SQL Reference Section D.1 Relational
Trang 27Section D.5 Functions
Section D.6 Return Codes Appendix E JMS Message Selector Syntax
Section E.1 Structure of a Selector
Section E.2 Identifiers
Section E.3 Literals
Section E.4 Operators
Section E.5 Expressions Appendix F FRMI Tools rmic: The Java RMI Compiler rmid: The RMI Activation
Daemon
Trang 28rmiregistry: The Java RMI
Section G.3 Comments
Section G.4 Basic Data Types Section G.5 Constants and Literals
Section G.6 Naming Scopes Section G.7 User-Defined
Data Types
Trang 29tnameserv: Transient Naming Service Daemon
About the Authors
Trang 30Colophon Index
Trang 32Java Enterprise in a Nutshell, 3rd Edition
By William Crawford, Jim Farley
Table of Contents | Index
Nothing is as constant as change, and this is as true in
enterprise computing as anywhere else With the recent
release of Java 2 Enterprise Edition 1.4, developers are
being called on to add even greater, more complex levels
of interconnectivity to their applications
Trang 33To do this, Java developers today need a clear
understanding of how to apply the new APIs, use the latest open source Java tools, and learn the capabilities and pitfalls in Java 2 Enterprise Edition 1.4 so they can plan a technology and implementation strategy for new enterprise projects
Fortunately, this is exactly what they get with the new
Java Enterprise in a Nutshell, 3rd Edition Because
most integrated development environments (IDE) today include API lookup, we took out the main API sections from our previous edition to make room for new
chapters, among others, on Ant, Cactus, Hibernate, Jakarta Struts, JUnit, security, XDoclet, and
XML/JAXP
Revised and updated for the new 1.4 version of Sun
Microsystems Java Enterprise Edition software, Java
Enterprise in a Nutshell, 3rd Edition is a practical guide
for enterprise Java developers.
Trang 35Java Enterprise in a Nutshell, 3rd Edition
By William Crawford, Jim Farley
What's New in This Edition
Contents of This Book
Java Programming Resources
Trang 36Examples Online
Conventions Used in This Book
Using Code Examples
Section 1.4 De Facto Standard
Enterprise Development Tools
Section 1.5 An Enterprise Computing
Scenario
Section 1.6 Other Enterprise APIs
Chapter 2 Application Assembly and
Deployment
Trang 37Section 2.1 J2EE Application Assembly
Model
Section 2.2 Component Modules
Section 2.3 Application Assemblies
Section 2.4 Deploying J2EE Applications
Chapter 3 Java Servlets
Section 3.1 Getting a Servlet
Environment
Section 3.2 Servlet Basics
Section 3.3 Web Applications
Section 3.4 Servlet Requests
Section 3.5 Servlet Responses
Section 3.6 Custom Servlet Initialization
Section 3.7 Security
Section 3.8 Servlet Filters
Section 3.9 Thread Safety
Section 3.10 Cookies
Section 3.11 Session Tracking
Section 3.12 Databases and Non-HTML
Content
Chapter 4 JavaServer Pages
Trang 38Section 4.1 JSP Basics
Section 4.2 JSP Actions
Section 4.3 The JSP Expression
Language
Section 4.4 JSP Standard Tag Library
Section 4.5 Custom Tags
Section 4.6 Wrapping Up
Chapter 5 JavaServer Faces
Section 5.1 The Sample Application
Section 5.2 Structure of a JSF
Application
Section 5.3 Managed Beans
Section 5.4 The JSF Expression
Language
Section 5.5 JSF Actions and Views
Section 5.6 Building Tables
Section 5.7 Validation
Section 5.8 Moving on with JSF
Chapter 6 Enterprise JavaBeans
Section 6.1 What Version Is Covered
Here?
Trang 39Section 6.2 EJB Component Model
Overview
Section 6.3 EJB Tutorial
Section 6.4 Deploying EJBs
Section 6.5 Using Enterprise JavaBeans
Section 6.6 Session Bean Specifics
Section 6.7 Entity Beans
Section 6.8 Message-Driven Beans
Section 6.9 Transaction Management
Section 6.10 EJB 3.0
Chapter 7 Java and XML
Section 7.1 Using XML Documents
Section 7.2 Java API for XML
Trang 40Section 8.3 Statements
Section 8.4 Results
Section 8.5 Handling Errors
Section 8.6 Prepared Statements
Section 8.7 BLOBs and CLOBs
Section 8.8 Metadata
Section 8.9 Transactions
Section 8.10 Stored Procedures
Section 8.11 Escape Sequences
Section 8.12 RowSets
Chapter 9 JNDI
Section 9.1 JNDI Architecture
Section 9.2 A Simple Example
Section 9.3 Introducing the Context
Section 9.4 Looking Up Objects in a
Context
Section 9.5 The NamingShell Application
Section 9.6 Listing the Children of aContext Section 9.7 Creating and Destroying
Trang 41Section 9.8 Binding Objects
Section 9.9 Accessing Directory
Services
Section 9.10 Modifying Directory Entries
Section 9.11 Creating Directory Entries
Section 9.12 Searching a Directory
Section 9.13 Event Notification
Chapter 10 J2EE Security
Section 10.1 Basic Security Concepts
Section 10.2 A Look at Java and J2EE
Security Standards
Section 10.3 Declarative Security Versus
Programmatic Security
Section 10.4 Web Component Security
Section 10.5 EJB Component Security
Section 10.6 Other J2EE Security Topics
Section 10.7 Limitations of J2EE Security
Chapter 11 Java Message Service
Section 11.1 JMS in the J2EE
Environment
Trang 42Section 11.2 Elements of Messaging with
JMS
Section 11.3 The Anatomy of Messages
Section 11.4 Point-to-Point Messaging
Section 11.5 Publish-Subscribe
Messaging
Section 11.6 Unified Messaging
Section 11.7 Transactional Messaging
Chapter 12 Web Services with JAX-RPC
and SAAJ
Section 12.1 What's Covered Here?
Section 12.2 Brief Introduction to Web
Services
Section 12.3 Java Web Services
Section 12.4 Writing Web Service Clients
Section 12.5 Writing Web Services
Section 12.6 Deploying Web Services
Chapter 13 Remote Method Invocation
Section 13.1 What's Covered Here?
Section 13.2 Introduction to RMI
Section 13.3 Defining Remote Objects
Trang 43Section 13.4 Creating the Stubs and
Skeletons
Section 13.5 Accessing Remote Objects
as a Client
Section 13.6 Dynamic Classloading
Section 13.7 Remote Object Activation
Section 13.8 RMI and Native Method
Calls
Section 13.9 RMI Over IIOP
Chapter 14 Java IDL (CORBA)
Section 14.1 A Note on Evolving
Standards
Section 14.2 The CORBA Architecture
Section 14.3 Creating CORBA Objects
Section 14.4 Putting It in the Public Eye
Section 14.5 Finding and Using Remote
Trang 44Section 15.2 Creating and Sending
Messages
Section 15.3 Retrieving Messages
Section 15.4 Multipart Messages
Chapter 16 Transactions
Section 16.1 Transaction Overview
Section 16.2 Programmatic Transactions
Versus Declarative Transactions
Section 16.3 Optimistic Concurrency
Section 16.4 EJB Transaction
Management
Section 16.5 Some Common
Programming Scenarios
Section 16.6 Transaction Best Practices
Part II: Open Source Enterprise Tools
Chapter 17 Ant
Section 17.1 What Version Is Covered
Here?
Section 17.2 Ant Overview
Section 17.3 Ant Fundamentals
Section 17.4 Core Tasks
Trang 45Section 17.5 Enterprise Tasks
Section 17.6 Creating Portable Build
Processes
Chapter 18 JUnit and Cactus
Section 18.1 What's Covered Here?
Section 18.2 Unit Testing Concepts
Section 18.3 JUnit Overview
Section 18.4 Using JUnit with Ant
Section 18.5 Testing Enterprise
Components with Cactus
Chapter 19 Struts
Section 19.1 The Scope of Struts
Section 19.2 The Sample Application
Section 19.3 The Development Process
with Struts
Section 19.4 The Struts Controller
Section 19.5 The Action Class
Section 19.6 Views in Struts
Section 19.7 Struts Tags
Section 19.8 Struts Plug-ins
Trang 46Section 19.9 DynaActionForms and the
Struts Validator
Chapter 20 Hibernate
Section 20.1 The Sample Application
Section 20.2 Principles of Hibernate
Section 20.3 Configuration and Mapping
Section 20.4 The Hibernate API
Section 20.5 HQL (Hibernate Query
Section 21.3 Annotation Tools
Section 21.4 XDoclet Tutorial
Section 21.5 J2SE Annotations Tutorial
Part III: Appendixes
Appendix A J2EE Deployment
Trang 47Descriptor Reference
Section A.1 Web Components (web.xml)
Section A.2 Enterprise JavaBeans
Section C.2 FROM Clause
Section C.3 SELECT Clause
Section C.4 WHERE Clause
Trang 48Section C.5 ORDER BY Clause
Appendix D SQL Reference
Section D.1 Relational Databases
Section D.2 Data Types
Section D.3 Schema Manipulation
Commands
Section D.4 Data Manipulation
Commands
Section D.5 Functions
Section D.6 Return Codes
Syntax Appendix E JMS Message Selector Section E.1 Structure of a Selector
Section E.2 Identifiers
Section E.3 Literals
Section E.4 Operators
Section E.5 Expressions
Appendix F FRMI Tools
rmic: The Java RMI Compiler
rmid: The RMI Activation Daemon
Trang 49rmiregistry: The Java RMI Object
Registry
serialver: The RMI Serial Version Utility
Appendix G IDL Reference
Section G.1 IDL Keywords
Section G.2 Identifiers
Section G.3 Comments
Section G.4 Basic Data Types
Section G.5 Constants and Literals
Section G.6 Naming Scopes
Section G.7 User-Defined Data Types
Section G.8 Exceptions
Section G.9 Module Declarations
Section G.10 Interface Declarations
Section G.11 Value Type Declarations
Appendix H HJava IDL Tools
idlj: The Java IDL Compiler
orbd: Naming Service Daemon
servertool
tnameserv: Transient Naming Service
Daemon
Trang 50About the Authors
Colophon
Index
Trang 51Java Enterprise in a Nutshell, Third Edition
by Jim Farley and William Crawford withPrakash Malani, John G Norman, andJustin Gehtland
Copyright © 2006 O'Reilly Media, Inc.All rights reserved Printed in the UnitedStates of America
Published by O'Reilly Media, Inc., 1005Gravenstein Highway North, Sebastopol,
Trang 52(safari.oreilly.com) For more
information, contact our
corporate/institutional sales department:(800) 998-9938 or
Trang 53Printing History:
September 1999: First Edition.
April 2002: Second Edition.
November 2005: Third Edition.
Nutshell Handbook, the Nutshell
Handbook logo, and the O'Reilly logo areregistered trademarks of O'Reilly Media,
Inc The In a Nutshell series designations,
Trang 54Java Enterprise in a Nutshell, Third
Edition, the image of a sand dollar, andrelated trade dress are trademarks ofO'Reilly Media, Inc
Java™ and all Java-based trademarks andlogos are trademarks or registered
trademarks of Sun Microsystems, Inc., inthe United States and other countries.O'Reilly Media, Inc is independent of SunMicrosystems
Many of the designations used by
manufacturers and sellers to distinguishtheir products are claimed as trademarks.Where those designations appear in thisbook, and O'Reilly Media, Inc was aware
of a trademark claim, the designations
Trang 55have been printed in caps or initial caps.
While every precaution has been taken inthe preparation of this book, the publisherand authors assume no responsibility forerrors or omissions, or for damages
resulting from the use of the informationcontained herein
ISBN: 0-596-10142-2
[M]
Trang 56This book is both a practical guide and aquick reference for Java™ programmerswho are writing enterprise applications.The world of enterprise development inthe Java environment consists of a mix ofstandardized APIs and services and defacto standard tools and APIs that havebeen developed in the Java community.The first part of the book provides a fast-paced introduction to key standard Javaenterprise principles and APIs: J2EE™deployment, servlets, JavaServer Pages™(JSPs), JavaServer™ Faces (JSF),
Enterprise JavaBeans™ (EJB), XML,JDBC™, Java Naming and Directory