The J2EE™ 1.4 Tutorial
902 pages
English

The J2EE™ 1.4 Tutorial

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
902 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

The J2EE™ 1.4 Tutorial
Eric Armstrong
Stephanie Bodoff
Debbie Carson
Ian Evans
Maydene Fisher
Dale Green
Kim Haase
Eric Jendrock
Monica Pawlan
Beth Stearns
May 30, 2003 Copyright © 2003 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.
All rights reserved.U.S. Government Rights - Commercial software. Government users are subject to the
Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supple-
ments.
This distribution may include materials developed by third parties.
Sun, Sun Microsystems, the Sun logo, Java, J2EE, JavaServer Pages, Enterprise JavaBeans, Java
Naming and Directory Interface, EJB, JSP, J2EE, J2SE and the Java Coffee Cup logo are trademarks or
registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
Unless otherwise licensed, software code in all technical materials herein (including articles, FAQs, sam-
ples) is provided under this License.
Products covered by and information contained in this service manual are controlled by U.S. Export Con-
trol laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical
biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly pro-
hibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export
exclusion lists, including, but not limited to, the denied persons and specially designated nationals ...

Sujets

Informations

Publié par
Nombre de lectures 108
Langue English
Poids de l'ouvrage 6 Mo

Extrait

The J2EE™ 1.4 Tutorial Eric Armstrong Stephanie Bodoff Debbie Carson Ian Evans Maydene Fisher Dale Green Kim Haase Eric Jendrock Monica Pawlan Beth Stearns May 30, 2003 Copyright © 2003 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supple- ments. This distribution may include materials developed by third parties. Sun, Sun Microsystems, the Sun logo, Java, J2EE, JavaServer Pages, Enterprise JavaBeans, Java Naming and Directory Interface, EJB, JSP, J2EE, J2SE and the Java Coffee Cup logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. Unless otherwise licensed, software code in all technical materials herein (including articles, FAQs, sam- ples) is provided under this License. Products covered by and information contained in this service manual are controlled by U.S. Export Con- trol laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly pro- hibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited. DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MER- CHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. Copyright © 2003 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, États- Unis. Tous droits réservés. Droits du gouvernement américain, utlisateurs gouvernmentaux - logiciel commercial. Les utilisateurs gouvernmentaux sont soumis au contrat de licence standard de Sun Microsystems, Inc., ainsi qu aux dis- positions en vigueur de la FAR [ (Federal Acquisition Regulations) et des suppléments à celles-ci. Cette distribution peut comprendre des composants développés pardes tierces parties. Sun, Sun Microsystems, le logo Sun, Java, JavaServer Pages, Enterprise JavaBeans, Java Naming and Directory Interface, EJB, JSP, J2EE, J2SE et le logo Java Coffee Cup sont des marques de fabrique ou des marques déposées de Sun Microsystems, Inc. aux États-Unis et dans d’autres pays. A moins qu’autrement autorisé, le code de logiciel en tous les matériaux techniques dans le présent (arti- cles y compris, FAQs, échantillons) est fourni sous ce permis. Les produits qui font l’objet de ce manuel d’entretien et les informations qu’il contient sont régis par la législation américaine en matière de contrôle des exportations et peuvent être soumis au droit d’autres pays dans le domaine des exportations et importations. Les utilisations finales, ou utilisateurs finaux, pour des armes nucléaires, des missiles, des armes biologiques et chimiques ou du nucléaire maritime, directe- ment ou indirectement, sont strictement interdites. Les exportations ou réexportations vers des pays sous embargo des États-Unis, ou vers des entités figurant sur les listes d’exclusion d’exportation américaines, y compris, mais de manière non exclusive, la liste de personnes qui font objet d’un ordre de ne pas partic- iper, d’une façon directe ou indirecte, aux exportations des produits ou des services qui sont régi par la législation américaine en matière de contrôle des exportations ("U .S. Commerce Department’s Table of Denial Orders "et la liste de ressortissants spécifiquement désignés ("U.S. Treasury Department of Spe- cially Designated Nationals and Blocked Persons "),, sont rigoureusement interdites. LA DOCUMENTATION EST FOURNIE "EN L’ÉTAT" ET TOUTES AUTRES CONDITIONS, DEC- LARATIONS ET GARANTIES EXPRESSES OU TACITES SONT FORMELLEMENT EXCLUES, DANS LA MESURE AUTORISEE PAR LA LOI APPLICABLE, Y COMPRIS NOTAMMENT TOUTE GARANTIE IMPLICITE RELATIVE A LA QUALITE MARCHANDE, A L’APTITUDE A UNE UTILISATION PARTICULIERE OU A L’ABSENCE DE CONTREFAÇON. Contents About This Tutorial. . . . . . . . . . . . . . . . . . . . . . . . . . .xix Who Should Use This Tutorial xix How to Read This Tutorial xix About the Examples xxi How to Print This Tutorial xxiii Typographical Conventions xxiii Chapter 1: Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Web Services Support 2 Extensible Markup Language 2 HTTP-SOAP Transport Protocol 3 WSDL Standard Format 3 UDDI and ebXML Standard Formats 4 Distributed Multitiered Applications 4 J2EE Components 5 J2EE Clients 6 Web Components 8 Business Components 8 Enterprise Information System Tier 10 J2EE Containers 10 Container Services 10 Container Types 11 Packaging 12 Development Roles 13 J2EE Product Provider 14 Tool Provider 14 Application Component Provider 14 Application Assembler 15 Application Deployer and Administrator 16 iii iv CONTENTS J2EE APIs 16 Enterprise JavaBeans Technology 16 JDBC API 17 Java Servlet Technology 17 JavaServer Pages Technology 17 Java Message Service 18 Java Naming and Directory Interface 18 Java Transaction API 18 JavaMail API 19 JavaBeans Activation Framework 19 Java API for XML Processing 19 Java API for XML Registries 19 Java API for XML-Based RPC 20 SOAP with Attachments API for Java (SAAJ) 20 J2EE Connector Architecture 21 Java Authentication and Authorization Service 21 Simplified Systems Integration 21 Chapter 2: Understanding XML. . . . . . . . . . . . . . . . . . . . . . . . . .23 Introduction to XML 23 What Is XML? 23 Why Is XML Important? 28 How Can You Use XML? 31 XML and Related Specs: Digesting the Alphabet Soup 33 Basic Standards 34 Schema Standards 38 Linking and Presentation Standards 40 Knowledge Standards 42 Standards That Build on XML 43 Summary 45 Generating XML Data 45 Writing a Simple XML File 45 Defining the Root Element 46 Writing Processing Instructions 50 Introducing an Error 52 Substituting and Inserting Text 53 Creating a Document Type Definition (DTD) 56 Documents and Data 62 Defining Attributes and Entities in the DTD 62 Referencing Binary Entities 69 CONTENTS v Defining Parameter Entities and Conditional Sections 71 Resolving A Naming Conflict 74 Using Namespaces 76 Designing an XML Data Structure 79 Saving Yourself Some Work 79 Attributes and Elements 79 Normalizing Data 82 Normalizing DTDs 83 Summary 84 Chapter 3: Getting Started with Web Applications . . . . . . . . . 85 Web Application Life Cycle 86 J2EE 1.4 Application Server 88 Components 88 Setting Up To Build and Deploy Tutorial Examples 89 Starting and Stopping the J2EE Application Server 90 Starting the deploytool Utility 91 Web Modules 91 Creating a Web Module 92 Configuring Web Modules 93 Mapping URLs to Web Components 94 Declaring Welcome Files 95 Setting Initialization Parameters 96 Specifying Error Mappings 96 Declaring References to Environment Entries, Resource Environment Entries, or Resources 97 Deploying Web Modules 98 Listing Deployed Web Modules 98 Running Web Applications 98 Updating Web Modules 99 Undeploying W 101 Duke’s Bookstore Examples 101 Accessing Databases from Web Applications 102 Starting the PointBase Database Server 103 Populating the Example Database 104 Defining a Data Source in the J2EE Server 105 Configuring the Web Application to Reference a Data Source with JNDI 106 Mapping the Web Application JNDI Name to a Data Source 107 Further Information 107 vi CONTENTS Chapter 4: Java API for XML Processing . . . . . . . . . . . . . . . . .109 The JAXP APIs 109 An Overview of the Packages 110 The Simple API for XML (SAX) APIs 111 The SAX Packages 114 The Document Object Model (DOM) APIs 114 The DOM Packages 116 The XML Stylesheet Language for Transformation (XSLT) APIs 117 The XSLT Packages 118 Compiling and Running the Programs 118 Where Do You Go from Here? 118 Chapter 5: Simple API for XML . . . . . . . . . . . . . . . . . . . . . . . . .121 When to Use SAX 122 Echoing an XML File with the SAX Parser 123 Creating the Skeleton 123 Importing Classes 124 Setting up for I/O 124 Implementing the ContentHandler Interface 125 Setting up the Parser 126 Writing the Output 127 Spacing the Output 128 Handling Content Events 128 Compiling and Running the Program 133 Checking the Output 134 Identifying the Events 135 Compressing the Output 137 Inspecting the Output 140 Documents and Data 141 Adding Additional Event Handlers 141 Identifying the Document’s Location 142 Handling Processing Instructions 144 Summary 145 Handling Errors with the Nonvalidating Parser 145 Displaying Special Characters and CDATA 153 Handling Special Characters 153 Handling Text with XML-Style Syntax 154 Handling CDATA and Other Characters 155 Parsing with a DTD 156 DTD’s Effect on the Nonvalidating Parser 156 CONTENTS vii Tracking Ignorable Whitespace 158 Cleanup 159 Empty Elements, Revisited 160 Echoing Entity References 160 Echoing the External Entity 160 Summarizing Entities 161 Choosing your Parser Implementation 162 Using the Validating Parser 162 Configuring the Factory 162 Validating with XML Schema 163 Experimenting with Validation Errors 166 Error Handling in the Validating Parser 168 Parsing a Parameterized DTD 169 DTD Warnings 170 Handling Lexical Events 171 How the LexicalHandler Works 172 Working with a LexicalHandler 172 Using the DTDHandler and EntityResolver 178 The DTDHandler API 178 The EntityResolver API 179 Further Information 180 Chapter 6: Document Object Model . . . . . . . . . . . . . . . . . . . 181 When to Use DOM 182 Documents vs. Data 182 Mixed Content Model 183 A Simpler Model 184 Increasing the Complexity 185 Choosing Your Model 187 Reading XML Data into a DOM 188 Creating the Program 188 Additional Information 193 Looking Ahead 195 Displaying a DOM Hierarch
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents