The Java™ EE 5 Tutorial
1300 pages
English

The Java™ EE 5 Tutorial

-

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

Description

The Java™ EE 5
Tutorial
For Sun Java System Application Server Platform Edition 9
Jennifer Ball
Debbie Carson
Ian Evans
Scott Fordin
Kim Haase
Eric Jendrock
June 16, 2006 Copyright © 2006 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, JavaBeans, JavaServer, JavaServer Pages, Enterprise Java-
Beans, Java Naming and Directory Interface, JavaMail, JDBC, EJB, JSP, J2EE, J2SE, “Write Once, Run
Anywhere”, 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 ...

Sujets

Informations

Publié par
Nombre de lectures 126
Langue English
Poids de l'ouvrage 9 Mo

Extrait

The Java™ EE 5 Tutorial For Sun Java System Application Server Platform Edition 9 Jennifer Ball Debbie Carson Ian Evans Scott Fordin Kim Haase Eric Jendrock June 16, 2006 Copyright © 2006 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, JavaBeans, JavaServer, JavaServer Pages, Enterprise Java- Beans, Java Naming and Directory Interface, JavaMail, JDBC, EJB, JSP, J2EE, J2SE, “Write Once, Run Anywhere”, 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 © 2006 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, JavaBeans, JavaServer, JavaServer Pages, Enterprise Java- Beans, Java Naming and Directory Interface, JavaMail, JDBC, EJB, JSP, J2EE, J2SE, “Write Once, Run Anywhere”, 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. . . . . . . . . . . . . . . . . . . . . . . . . xxvii Who Should Use This Tutorial xxvii Prerequisites xxvii How to Read This Tutorial xxviii About the Examples xxx Further Information xxxiv How to Print This Tutorial xxxiv Typographical Conventions xxxiv Feedback xxxv Chapter 1: Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Java EE Application Model 2 Distributed Multitiered Applications 3 Security 4 Java EE Components 4Clients 4 Web Components 7 Business Components 7 Enterprise Information System Tier 9 Java EE Containers 9 Container Services 9 Container Types 10 Web Services Support 11 XML 12 SOAP Transport Protocol 13 WSDL Standard Format 13 UDDI and ebXML Standard Formats 13 Java EE Application Assembly and Deployment 14 Packaging Applications 14 iii iv CONTENTS Development Roles 16 Java EE Product Provider 16 Tool Provider 16 Application Component Provider 17 Application Assembler 17 Application Deployer and Administrator 18 Java EE 5 APIs 19 Enterprise JavaBeans Technology 19 Java Servlet Technology 20 JavaServer Pages Technology 20 JavaServer Pages Standard Tag Library 20 JavaServer Faces 20 Java Message Service API 21 Java Transaction API 21 JavaMail API 21 JavaBeans Activation Framework 22 Java API for XML Processing 22 Java API for XML Web Services (JAX-WS) 22 Java Architecture for XML Binding (JAXB) 23 SOAP with Attachments API for Java 23 Java API for XML Registries 23 J2EE Connector Architecture 24 Java Database Connectivity API 24 Java Persistence API 24 Java Naming and Directory Interface 25 Java Authentication and Authorization Service 26 Simplified Systems Integration 26 Sun Java System Application Server Platform Edition 9 26 Tools 27 Starting and Stopping the Application Server 28 Starting the Admin Console 29 Starting and Stopping the Java DB Database Server 30 Debugging Java EE Applications 30 Part One: The Web Tier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 Chapter 2: Getting Started with Web Applications. . . . . . . . . .35 Web Application Life Cycle 38 Web Modules 40 Packaging Web Modules 42 Deploying a WAR File 43 CONTENTS v Testing Deployed Web Modules 44 Listing Deployed Web Modules 44 Updating Web Modules 45 Undeploying Web Modules 47 Configuring Web Applications 48 Mapping URLs to Web Components 48 Declaring Welcome Files 49 Setting Initialization Parameters 50 Mapping Errors to Error Screens 50 Declaring Resource References 51 Duke’s Bookstore Examples 54 Accessing Databases from Web Applications 54 Populating the Example Database 55 Creating a Data Source in the Application Server 55 Further Information 56 Chapter 3: Java Servlet Technology . . . . . . . . . . . . . . . . . . . . . 57 What Is a Servlet? 57 The Example Servlets 58 Troubleshooting 60 Servlet Life Cycle 61 Handling Servlet Life-Cycle Events 61 Handling Errors 64 Sharing Information 64 Using Scope Objects 64 Controlling Concurrent Access to Shared Resources 65 Accessing Databases 67 Initializing a Servlet 68 Writing Service Methods 69 Getting Information from Requests 70 Constructing Responses 72 Filtering Requests and Responses 75 Programming Filters 75 Programming Customized Requests and Responses 77 Specifying Filter Mappings 80 Invoking Other Web Resources 82 Including Other Resources in the Response 82 Transferring Control to Another Web Component 84 Accessing the Web Context 85 Maintaining Client State 86 vi CONTENTS Accessing a Session 86 Associating Objects with a Session 86 Session Management 87 Session Tracking 88 Finalizing a Servlet 89 Tracking Service Requests 89 Notifying Methods to Shut Down 90 Creating Polite Long-Running Methods 91 Further Information 92 Chapter 4: JavaServer Pages Technology . . . . . . . . . . . . . . . .93 What Is a JSP Page? 93 Example 94 The Example JSP Pages 97 The Life Cycle of a JSP Page 102 Translation and Compilation 102 Execution 103 Creating Static Content 105 Response and Page Encoding 106 Creating Dynamic Content 106 Using Objects within JSP Pages 106 Unified Expression Language 108 Immediate and Deferred Evaluation Syntax 110 Value and Method Expressions 112 Defining a Tag Attribute Type 119 Deactivating Expression Evaluation 120 Literal Expressions 121 Resolving Expressions 122 Implicit Objects 125 Operators 126 Reserved Words 127 Examples 128 Functions 129 JavaBeans Components 131 JavaBeans Component Design Conventions 131 Creating and Using a JavaBeans Component 133 Setting JavaBeans Component Properties 134 Retrieviponent Properties 136 Using Custom Tags 137 Declaring Tag Libraries 137 CONTENTS vii Including the Tag Library Implementation 139 Reusing Content in JSP Pages 140 Transferring Control to Another Web Component 141 jsp:param Element 141 Including an Applet 142 Setting Properties for Groups of JSP Pages 144 Further Information 147 Chapter 5: JavaServer Pages Documents . . . . . . . . . . . . . . . 149 The Example JSP Document 150 Creating a JSP Document 152 Declaring Tag Libraries 154 Including Directives in a JSP Document 156 Creating Static and Dynamic Content 158 Using the jsp:root Element 161 Using the jsp:output Element 162 Identifying the JSP Document to the Container 166 Chapter 6: JavaServer Pages Standard Tag Library . . . . . . . 167 The Example JSP Pages 168 Using JSTL 169 Tag Collaboration 170 Core Tag Library 172 Variable Support Tags 172 Flow Control Tags 174 URL Tags 177 Miscellaneous Tags 178 XML Tag Library 180 Core Tags 181 Flow Control Tags 182 Transformation Tags 183 Internationalization Tag Library 1
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents