2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. JAVA ENTERPRISE IN A NUTSHELL Third Edition Jim Farley and William Crawford with Prakash Malani, John G. Norman, and Justin Gehtland O'REILLY 4 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo
Table of Contents Preface xi Part I. The Java Enterprise APIs 1. Introduction Enterprise Computing Defined Enterprise Computing Demystified Standard Java Enterprise APIs De Facto Standard Enterprise Development Tools An Enterprise Computing Scenario Other Enterprise APIs 2. Application Assembly and Deployment J2EE Application Assembly Model Component Modules Application Assemblies Deploying J2EE Applications 3. Java Servlets Getting a Servlet Environment Servlet Basics Web Applications Servlet Requests Servlet Responses 3 4 4 5 14 20 23 25 26 34 38 41 46 47 47 51 54 57
Custom Servlet Initialization 61 Security 64 Servlet Filters 65 Thread Safety 68 Cookies 71 Session Tracking 72 Databases and Non-HTML Content 75 4. JavaServer Pages 78 JSP Basics 80 JSP Actions 85 The JSP Expression Language 87 JSP Standard Tag Library 90 Custom Tags 94 Wrapping Up 101 5. JavaServer Faces 102 The Sample Application 103 Structure of a JSF Application 103 Managed Beans 105 The JSF Expression Language 109 JSF Actions and Views 111 Building Tables 121 Validation 125 Moving on with J SF 129 6. Enterprise JavaBeans 130 What Version Is Covered Here? 131 EJB Component Model Overview 132 EJB Tutorial 136 Deploying EJBs 142 Using Enterprise JavaBeans 150 Session Bean Specifics 154 Entity Beans 159 Message-Driven Beans 183 Transaction Management 187 EJB 3.0 190 7. JavaandXML 193 Using XML Documents 194 Java API for XML Processing 199 Table of Contents
SAX DOM XSLT 8. JDBC. JDBC Architecture Connecting to the Database Statements Results Handling Errors Prepared Statements BLOBs and CLOBs Metadata Transactions Stored Procedures Escape Sequences RowSets 9. JNDI JNDI Architecture A Simple Example Introducing the Context Looking Up Objects in a Context The NamingShell Application Listing the Children of a Context Creating and Destroying Contexts Binding Objects Accessing Directory Services Modifying Directory Entries Creating Directory Entries ' Searching a Directory Event Notification 1 1 10. J2EE Security i,* Basic Security Concepts ; A Look at Java and J2EE Security Standards Declarative Security Versus Programmatic Security Web Component Security EJB Component Security Other J2EE Security Topics Limitations of J2EE Security 201 205 214 218 219 223 225 227 233 235 238 239 241 244 246 247 249 250 251 253 255 256 262 267 269 270 275 276 111 281 289 289 292 294 295 304 307 310 Table of Contents 1 vi
11. Java Message Service 312 JMS in the J2EE Environment 313 Elements of Messaging with JMS 313 The Anatomy of Messages 321 Point-to-Point Messaging 325 Publish-Subscribe Messaging 331 Unified Messaging 333 Transactional Messaging 334 12. Web Services with JAX-RPC and SAAJ 336 What's Covered Here? 336 Brief Introduction to Web Services 337 Java Web Services 345 Writing Web Service Clients 349 Writing Web Services 358 Deploying Web Services 363 13. Remote Method Invocation 375 What's Covered Here? 375 Introduction to RMI 376 Defining Remote Objects 386 Creating the Stubs and Skeletons 389 Accessing Remote Objects as a Client 390 Dynamic Classloading 394 Remote Object Activation 399 RMI and Native Method Calls 410 RMI Over HOP 414 14. JavaIDL(CORBA) 417 A Note on Evolving Standards 418 The CORBA Architecture 419 Creating CORBA Objects 422 Putting It in the Public Eye 434 Finding and Using Remote Objects 442 What If I Don't Have the Interface? 451 15. JavaMail 456 Email and JavaMail 457 Creating and Sending Messages 463 Retrieving Messages 465 Multipart Messages 471 viii I Table of Contents
16. Transactions 475 Transaction Overview 475 Programmatic Transactions Versus Declarative Transactions 486 Optimistic Concurrency 488 EJB Transaction Management 490 Some Common Programming Scenarios 492 Transaction Best Practices 497 Part II. Open Source Enterprise Tools 17. Ant 501 What Version Is Covered Here? 502 Ant Overview 502 Ant Fundamentals 503 Core Tasks 509 Enterprise Tasks 522 Creating Portable Build Processes 532 18. JUnitand Cactus 540 What's Covered Here? 541 Unit Testing Concepts 542 JUnit Overview 545 Using JUnit with Ant 554 Testing Enterprise Components with Cactus 561 19. Struts 588 The Scope of Struts 588 The Sample Application 590 The Development Process with Struts 591 The Struts Controller 593 The Action Class 596 Views in Struts 604 Struts Tags 609 Struts Plug-ins 615 DynaActionForms and the Struts Validator 616 20. Hibernate 619 The Sample Application 619 Principles of Hibernate 620 Configuration and Mapping 622 Table of Contents
The Hibernate API HQL (Hibernate Query Language) Hibernate Services Conclusion 21. Annotations with XDoclet and J2SE Metadata... What's Covered Here? What Are Code Annotations? Annotation Tools XDoclet Tutorial J2SE Annotations Tutorial 640 649 650 655 656 656 656 658 658 676 Part III. Appendixes A. J2EE Deployment Descriptor Reference 689 B. JavaServer Faces Tag Libraries 741 C. Enterprise JavaBeans Query Language Syntax 756 D. SQL Reference 767 E. JMS Message Selector Syntax 783 F. RMITools 787 6. IDLReference 795 H. Java IDL Tools 829 Index 837 Table of Contents