You are previewing Sams Teach Yourself J2EE™ in 21 Days, Second Edition.
O'Reilly logo
Sams Teach Yourself J2EE™ in 21 Days, Second Edition

Book Description

J2EE has become required knowledge for any serious Java developer, but learning this large and complex specification requires a substantial investment of time and energy. Sams Teach Yourself J2EE in 21 Days, 2/E presents the enterprise Java architecture in accessible, easy-to-comprehend lessons, describing how each J2EE tool solves the challenges of n-Tier development. Using the architecture as a roadmap, chapters describe Enterprise JavaBeans (EJB), JavaServer Pages (JSP), Java Servlets, and more, giving readers a full understanding of J2EE development.

Further chapters cover the role of XML, custom JSP tags, creating J2EE Web Services, and how Java Connectors allow J2EE applications to interact with legacy and non-Java systems. The book finishes with sample applications which put all the pieces together, including an example using J2EE to create Web Services. Along the way, every concept is illustrated with practical, real-world examples to ensure understanding by Java students as well as experts.

Table of Contents

  1. Copyright
  2. About the Authors
  3. Acknowledgments
  4. Tell Us What You Think!
  5. Introduction
  6. Introducing J2EE and Enterprise JavaBeans
    1. The Challenge of N-tier Development
      1. Monolithic Development
      2. The Move into the Second Tier
      3. Developing 3-tier Architectures
      4. Complexity Simplified by Modularity
      5. Component Technology
      6. Modern N-tier Architectures
      7. A Model for Enterprise Computing
      8. Java 2 Enterprise Edition (J2EE)
      9. The Future of J2EE
      10. Summary
      11. Q&A
      12. Exercises
    2. The J2EE Platform and Roles
      1. Revisiting the J2EE Platform
      2. Understanding J2EE Components
      3. Enterprise JavaBeans
      4. Web Applications
      5. Application Clients
      6. J2EE Technologies
      7. J2EE Platform Roles
      8. Packaging and Deploying J2EE Applications
      9. Summary
      10. Q&A
      11. Exercise—Sun Microsystems' J2EE SDK
      12. Exercise—Case Study
    3. Naming and Directory Services
      1. Naming and Directory Services
      2. Using JNDI with J2EE RI
      3. Using JNDI Outside J2EE
      4. Using JNDI Functionality
      5. Directory Services
      6. JNDI Security
      7. Summary
      8. Q&A
      9. Exercise
    4. Introduction to Enterprise JavaBeans
      1. What Is an EJB?
      2. Why Use EJBs?
      3. What's in an EJB?
      4. How Do I Create an EJB?
      5. How Do I Deploy an EJB?
      6. How Do I Use an EJB?
      7. Using the J2EE Reference Implementation
      8. Summary
      9. Q&A
      10. Exercises
    5. Session EJBs
      1. Overview
      2. The javax.ejb Package for Session beans
      3. Specifying a Stateless Session bean
      4. Implementing a Stateless Session Bean
      5. Configuring a Stateless Session bean
      6. Configuring a Session Bean Using J2EE RI deploytool
      7. Client Applications
      8. Configuring J2EE RI Client Applications with deploytool
      9. Running the Agency Case Study Example
      10. Stateful Session Beans
      11. Timer Service
      12. Gotchas
      13. Summary
      14. Q&A
      15. Exercises
    6. Entity EJBs
      1. Overview
      2. The javax.ejb Package for Entity Beans
      3. Remote Versus Local Interfaces
      4. BMP Entity Bean Lifecycle
      5. Specifying a BMP Entity Bean
      6. Implementing a BMP Entity Bean
      7. Configuring and Deploying a BMP Entity Bean
      8. Client's View
      9. Gotchas
      10. Summary
      11. Q&A
      12. Exercise
    7. Container-Managed Persistence and EJB Query Language
      1. Overview of Container-Managed Persistence
      2. CMP Entity Bean Lifecycle
      3. Container-Managed Relationships
      4. EJB QL
      5. Select Methods
      6. Implementing a CMP Entity Bean
      7. Deploying a CMP Entity EJB Using J2EE RI
      8. Design Notes for CMP Entity Beans
      9. Gotchas
      10. Summary
      11. Q&A
      12. Exercises
  7. Developing J2EE Applications
    1. Transactions and Persistence
      1. Overview of Transactions
      2. Container-Managed Transaction Demarcation
      3. Bean-Managed Transaction Demarcation
      4. Extended Stateful Session Bean Lifecycle
      5. Transactions: Behind the Scenes
      6. Overview of Persistence Technologies
      7. JDBC
      8. SQLj
      9. Java Data Objects (JDO)
      10. Summary
      11. Q&A
      12. Exercises
    2. Java Message Service
      1. Messaging
      2. Java Message Service API
      3. JMS API Architecture
      4. Using JMS with the J2EE RI
      5. Point-to-Point Messaging Example
      6. Simple Synchronous Receiver Example
      7. The Publish/Subscribe Messaging Domain
      8. Publish/Subscribe Messaging Example
      9. Additional JMS Features
      10. Summary
      11. Q&A
      12. Exercise
    3. Message-Driven Beans
      1. What Are Message-Driven Beans?
      2. Programming Interfaces in a Message-Driven Bean
      3. Life Cycle of a Message-Driven Bean
      4. Adding an MDB to the Agency Case Study
      5. Summary
      6. Q&A
      7. Exercise
    4. JavaMail
      1. Understanding Email
      2. Introducing the JavaMail API
      3. Setting up Your Development Environment
      4. Sending a Simple Email
      5. Sending Emails with Attachments
      6. Retrieving Email Messages
      7. Using JavaMail Within J2EE Components
      8. Summary
      9. Q&A
      10. Exercise
    5. Servlets
      1. The Purpose and Use of Servlets
      2. Introduction to HTTP
      3. Introduction to HTML
      4. The Servlet Environment
      5. The Servlet Class Hierarchy
      6. Simple Servlet Example
      7. Passing Parameter Data to a Servlet
      8. Web Applications
      9. Handling Errors
      10. Retaining Client and State Information
      11. Servlet Filtering
      12. Event Listening
      13. Servlet Threads
      14. Security and the Servlet Sandbox
      15. Agency Case Study
      16. Summary
      17. Q&A
      18. Exercises
    6. JavaServer Pages
      1. What Is a JSP?
      2. JSP Syntax and Structure
      3. First JSP Example
      4. JSP Lifecycle
      5. JSP Directives
      6. Accessing HTTP Servlet Variables
      7. Expression Language (EL)
      8. Simplifying JSP Pages with JavaBeans
      9. Adding a Web Interface to the Agency Case Study
      10. Web Application Architecture
      11. Summary
      12. Q&A
      13. Exercise
    7. JSP Tag Libraries
      1. The Role of Tag Libraries
      2. JavaServer Pages Standard Tag Library (JSTL)
      3. Developing a Simple Custom Tag
      4. Tags with Attributes
      5. Tags that Define EL Variables
      6. Iterative Tags
      7. Cooperating Tags
      8. Summary
      9. Q&A
      10. Exercise
  8. Integrating J2EE into the Enterprise
    1. Security
      1. Security Terminology
      2. Common Security Technology
      3. Security in J2EE
      4. Working with J2EE RI Security
      5. Security and EJBs
      6. Applying EJB Security with J2EE RI
      7. Security in Web Applications and Components
      8. Applying Web Security using J2EE RI
      9. Security and JNDI
      10. Summary
      11. Q&A
      12. Exercises
    2. Integrating XML with J2EE
      1. The Drive to Platform-Independent Data Exchange
      2. Origins of XML
      3. Structure and Syntax of XML
      4. Creating Valid XML
      5. J2EE Support for XML
      6. The JAXP Packages
      7. Parsing XML Using SAX
      8. Document Object Model (DOM) Parser
      9. Java Architecture for XML Binding
      10. Summary
      11. Q&A
      12. Exercise
    3. Transforming XML Documents
      1. Presenting XML to Clients
      2. XML Stylesheet for Transformation (XSLT)
      3. Using XSLT in Java Applications
      4. XSLT Stylesheets
      5. Using Stylesheet Elements
      6. XSLT Compilers
      7. Summary
      8. Q&A
      9. Exercises
    4. Patterns
      1. J2EE Patterns
      2. J2EE-Specific Patterns
      3. Applying Patterns in Context
      4. Directions for J2EE Patterns
      5. Summary
      6. Q & A
      7. Exercises
    5. Integrating with External Resources
      1. Reviewing External Resources and Legacy Systems
      2. Introducing Other Connectivity Technologies
      3. Connector Architecture
      4. Introducing CORBA
      5. Using RMI over IIOP
      6. Introducing JNI
      7. Summary
      8. Q&A
      9. Exercises
    6. Using RPC-Style Web Services with J2EE
      1. Web Service Overview
      2. Web Services for J2EE
      3. Creating a Web Service with JAX-RPC
      4. The JAX-RPC API
      5. Creating a Simple Service
      6. Packaging and Deploying the Simple Web Service Using J2EE RI deploytool
      7. Consuming the Simple Greeting Service
      8. Building More Robust Web Services
      9. Exposing EJBs Through Web Service Protocols
      10. Packaging and Deploying the Agency Web Service Using J2EE RI deploytool
      11. Consuming the Simple Greeting Service
      12. Other Considerations for Web Services
      13. Summary
      14. Q&A
      15. Exercises
    7. Message-Style Web Services and Web Service Registries
      1. Message-based SOAP Services
      2. Implementing an SAAJ-based Web Service
      3. Packaging and Deploying the Simple Web Service Using J2EE RI deploytool
      4. Consuming the SAAJ Web Service
      5. More Complex Message Exchange
      6. Registries for Web Services
      7. Accessing Information in a UDDI Registry
      8. Using JAXR for Registry Access
      9. Contacting a Registry Using JAXR
      10. Storing Information in a Registry Using JAXR
      11. Retrieving Information from a Registry Using JAXR
      12. Summary
      13. Q&A
      14. Exercises
  9. Appendixes
    1. An Overview of XML
      1. What Is XML?
      2. Enforcing XML Document Structure
      3. Where to Find More Information
    2. The Java Community Process
      1. Introducing the JCP
      2. Getting Involved
      3. Understanding the JSR Process
      4. Taking the Next Step
    3. Glossary
  10. Index