The-Java-EE-6-Tutorial-Volume-I.pdf
(
5432 KB
)
Pobierz
The Java EE 6 Tutorial Volume I
TheJavaEE6Tutorial,VolumeI
BasicConcepts
Sun Microsystems, Inc.
4150 Network Circle
Santa Clara, CA 95054
U.S.A.
Part No: 820–7627–10
December 2009
Copyright 2009 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. All rights reserved.
Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without
limitation, these intellectual property rights may include one or more U.S. patents or pending patent applications in the U.S. and in other countries.
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 supplements.
This distribution may include materials developed by third parties.
Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other
countries, exclusively licensed through X/Open Company, Ltd.
Sun, Sun Microsystems, the Sun logo, the Solaris logo, the Java Coee Cup logo, docs.sun.com, Enterprise JavaBeans, EJB, GlassFish, J2EE, J2SE, Java Naming and
Directory Interface, JavaBeans, Javadoc, JDBC, JDK, JavaScript, JavaServer, JavaServer Pages, JMX, JRE, JSP, JVM, MySQL, NetBeans, OpenSolaris, SunSolve, Sun
GlassFish, Java, and Solaris are trademarks or registered trademarks of Sun Microsystems, Inc. or its subsidiaries in the U.S. and other countries. All SPARC
trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing
SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc.
The OPEN LOOK and Sun
TM
Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering eorts
of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to
the Xerox Graphical User Interface, which license also covers Sun's licensees who implement OPEN LOOK GUIs and otherwise comply with Sun's written license
agreements.
Products covered by and information contained in this publication are controlled by U.S. Export Control laws and may be subject to the export or import laws in
other countries. Nuclear, missile, chemical or biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export
or reexport to countries subject to U.S. embargo or to entities identied 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 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO
THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.
Copyright 2009 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. Tous droits réservés.
Sun Microsystems, Inc. détient les droits de propriété intellectuelle relatifs à la technologie incorporée dans le produit qui est décrit dans ce document. En particulier,
et ce sans limitation, ces droits de propriété intellectuelle peuvent inclure un ou plusieurs brevets américains ou des applications de brevet en attente aux Etats-Unis
et dans d'autres pays.
Cette distribution peut comprendre des composants développés par des tierces personnes.
Certaines composants de ce produit peuvent être dérivées du logiciel Berkeley BSD, licenciés par l'Université de Californie. UNIX est une marque déposée aux
Etats-Unis et dans d'autres pays; elle est licenciée exclusivement par X/Open Company, Ltd.
Sun, Sun Microsystems, le logo Sun, le logo Solaris, le logo Java Coee Cup, docs.sun.com, Enterprise JavaBeans, EJB, GlassFish, J2EE, J2SE, Java Naming and
Directory Interface, JavaBeans, Javadoc, JDBC, JDK, JavaScript, JavaServer, JavaServer Pages, JMX, JRE, JSP, JVM, MySQL, NetBeans, OpenSolaris, SunSolve, Sun
GlassFish, Java et Solaris sont des marques de fabrique ou des marques déposées de Sun Microsystems, Inc., ou ses liales, aux Etats-Unis et dans d'autres pays.
Toutes les marques SPARC sont utilisées sous licence et sont des marques de fabrique ou des marques déposées de SPARC International, Inc. aux Etats-Unis et dans
d'autres pays. Les produits portant les marques SPARC sont basés sur une architecture développée par Sun Microsystems, Inc.
L'interface d'utilisation graphique OPEN LOOK et Sun a été développée par Sun Microsystems, Inc. pour ses utilisateurs et licenciés. Sun reconnaît les eorts de
pionniers de Xerox pour la recherche et le développement du concept des interfaces d'utilisation visuelle ou graphique pour l'industrie de l'informatique. Sun détient
une licence non exclusive de Xerox sur l'interface d'utilisation graphique Xerox, cette licence couvrant également les licenciés de Sun qui mettent en place l'interface
d'utilisation graphique OPEN LOOK et qui, en outre, se conforment aux licences écrites de Sun.
Les produits qui font l'objet de cette publication et les informations qu'il contient sont régis par la legislation 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 nales, ou utilisateurs naux, pour des armes nucléaires,
des missiles, des armes chimiques ou biologiques ou pour le nucléaire maritime, directement ou indirectement, sont strictement interdites. Les exportations ou
réexportations vers des pays sous embargo des Etats-Unis, ou vers des entités gurant 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 participer, d'une façon directe ou indirecte, aux exportations des produits ou des services qui
sont régis par la legislation américaine en matière de contrôle des exportations et la liste de ressortissants spéciquement designés, sont rigoureusement interdites.
LA DOCUMENTATION EST FOURNIE "EN L'ETAT" ET TOUTES AUTRES CONDITIONS, DECLARATIONS 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 CONTREFACON.
091209@23031
Contents
Preface
...................................................................................................................................................19
PartI Introduction
.........................................................................................................................................27
1 Overview
...............................................................................................................................................29
Java EE 6 Highlights ............................................................................................................................ 30
Java EE Application Model ................................................................................................................. 30
Distributed Multitiered Applications ............................................................................................... 31
Security .......................................................................................................................................... 32
Java EE Components ................................................................................................................... 33
Java EE Clients .............................................................................................................................. 33
Web Components ........................................................................................................................ 35
Business Components ................................................................................................................. 36
Enterprise Information System Tier .......................................................................................... 37
Java EE Containers .............................................................................................................................. 37
Container Services ....................................................................................................................... 38
Container Types ........................................................................................................................... 38
Web Services Support ......................................................................................................................... 40
XML ............................................................................................................................................... 40
SOAP Transport Protocol ...........................................................................................................41
WSDL Standard Format ..............................................................................................................41
Java EE Application Assembly and Deployment ............................................................................. 41
Packaging Applications ...................................................................................................................... 42
Development Roles ............................................................................................................................. 43
Java EE Product Provider ............................................................................................................ 44
Tool Provider ................................................................................................................................ 44
Application Component Provider ............................................................................................. 44
3
Contents
Application Assembler ................................................................................................................ 45
Application Deployer and Administrator ................................................................................. 45
Java EE 6 APIs ...................................................................................................................................... 46
Enterprise JavaBeans Technology .............................................................................................. 46
Java Servlet Technology .............................................................................................................. 46
JavaServer Faces Technology ...................................................................................................... 47
JavaServer Pages Technology ..................................................................................................... 47
JavaServer Pages Standard Tag Library ..................................................................................... 47
Java Persistence API ..................................................................................................................... 48
Java Transaction API ................................................................................................................... 48
Java API for RESTful Web Services (JAX-RS) .......................................................................... 48
Java Message Service API ............................................................................................................ 48
Java EE Connector Architecture ................................................................................................ 49
JavaMail API ................................................................................................................................. 49
Java Authorization Service Provider Contract for Containers (Java ACC) .......................... 49
Java Authentication Service Provider Interface for Containers (JASPIC) ............................ 49
Java API for XML Registries ....................................................................................................... 50
Simplied Systems Integration ................................................................................................... 50
Java EE 6 APIs Included in the Java Platform, Standard Edition 6.0 (Java SE 6) .......................... 51
Java Database Connectivity API ................................................................................................. 51
Java Naming and Directory Interface ........................................................................................ 51
JavaBeans Activation Framework .............................................................................................. 52
Java API for XML Processing ..................................................................................................... 52
Java Architecture for XML Binding (JAXB) ............................................................................. 52
SOAP with Attachments API for Java ........................................................................................ 52
Java API for XML Web Services (JAX-WS) .............................................................................. 53
Java Authentication and Authorization Service ....................................................................... 53
Sun GlassFish Enterprise Server v3 ................................................................................................... 53
Tools .............................................................................................................................................. 53
2 UsingtheTutorialExamples
..............................................................................................................55
Required Software ............................................................................................................................... 55
Java Platform, Standard Edition ................................................................................................. 55
Java EE 6 Software Development Kit (SDK) ............................................................................. 56
Apache Ant ................................................................................................................................... 56
4
TheJavaEE6Tutorial,VolumeI • December2009
Contents
To Start the Administration Console in NetBeans IDE .......................................................... 60
Starting and Stopping the Java DB Database Server ........................................................................ 60
Building the Examples ........................................................................................................................ 60
Tutorial Example Directory Structure .............................................................................................. 61
Getting the Latest Updates to the Tutorial ....................................................................................... 61
▼
To Update the Tutorial through the Update Center ................................................................ 61
Debugging Java EE Applications ....................................................................................................... 62
Using the Server Log .................................................................................................................... 62
Using a Debugger ......................................................................................................................... 62
PartII TheWebTier
.........................................................................................................................................65
3 GettingStartedwithWebApplications
...........................................................................................67
Web Applications ................................................................................................................................ 67
Web Application Life Cycle ................................................................................................................ 69
Web Modules ....................................................................................................................................... 71
Packaging Web Modules .............................................................................................................72
Deploying a WAR File ................................................................................................................. 73
Testing Deployed Web Modules ................................................................................................ 75
Listing Deployed Web Modules ................................................................................................. 75
Updating Web Modules ..............................................................................................................75
Undeploying Web Modules ........................................................................................................ 76
Conguring Web Applications .......................................................................................................... 77
Mapping URLs to Web Components ........................................................................................ 77
Declaring Welcome Files ............................................................................................................ 79
Setting Initialization Parameters ................................................................................................ 79
Mapping Errors to Error Screens ............................................................................................... 81
Declaring Resource References .................................................................................................. 82
Further Information about Web Applications ................................................................................. 84
5
Java EE 6 Tutorial Component ................................................................................................... 57
NetBeans IDE ............................................................................................................................... 58
Starting and Stopping the Enterprise Server .................................................................................... 58
Starting the Administration Console ................................................................................................59
▼
Plik z chomika:
slimkaa
Inne pliki z tego folderu:
Javascript-1-4.pdf
(1848 KB)
Research-Based-Web-Design-Usability-Guidelines.pdf
(21138 KB)
Windows-7-100-Most-Asked-Questions-Edition-2009.pdf
(1259 KB)
Learn-How-to-Repair-Computers-Get-Certified-in-15-Weeks.pdf
(2351 KB)
Eloquent-Javascript.pdf
(1425 KB)
Inne foldery tego chomika:
Pliki dostępne do 01.06.2025
Pliki dostępne do 19.01.2025
Administracja ogólna
Analiza finansowa
Analiza finansowa (ekonomiczna)
Zgłoś jeśli
naruszono regulamin