The J2Ee Tutorial (Java Series)
معرفی کتاب «The J2Ee Tutorial (Java Series)» نوشتهٔ Stephanie Bodoff, Dale Green, Kim Haase, Eric Jendrock, Monica Pawlan, Beth Stearns، منتشرشده توسط نشر Addison-Wesley Professional در سال 2002. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «The J2Ee Tutorial (Java Series)» در دستهٔ بدون دستهبندی قرار دارد.
\* Gentle, self-paced introductions to servlets, JSP, JDBC, EJBs, XML, JMS, JNDI, and many other key topics. \* Follows the same approach and format that made The JavaTTM Tutorial a worldwide best-seller! \* Includes CD-ROM containing all content, examples, and both the J2EE and J2SE Version 1.3 software platforms. Following in the footsteps of the The Java Tutorial - a global best-seller - The J2EE Tutorial offers an indispensable, example-centered resource for every developer who wants to master enterprise development with Java 2 Enterprise Edition, Version 1.3. The authors - all of them Sun senior writers with direct access to the architects of the J2EE platform - offer concise, hands-on introductions to each key J2EE technology. They offer practical techniques and examples for working with Enterprise JavaBeans, servlets, JavaServer Pages, Java Message Service (JMS), Java Naming and Directory Interface (JNDI), XML, the J2EE Connector Architecture, JavaMail, and JDBC. The book has been refined to reflect thousands of comments from developers utilizing draft editions published on the Web. All contents and examples are also provided on the accompanying CD-ROM, along with complete copies of the J2EE and J2SE Version 1.3 platform. For every experienced Java programmer who wants to build enterprise solutions with Java 2 Enterprise Edition Version 1.3. About the Authors: Stephanie Bodoff, Dale Green, Eric Jendrock, and Monica Pawlan are senior writers at Sun working closely with the architects of Sun's J2EE technologies. Beth Stearns is principal partner of ComputerEase Publishing, a consulting firm she founded in 1982. Her client list includes Sun Microsystems, Silicon Graphics, Oracle, and Xerox. Foreword......Page 15 Preface......Page 19 Overview......Page 25 Distributed Multitiered Applications......Page 26 J2EE Components......Page 27 Applets......Page 28 J2EE Server Communications......Page 29 Web Components......Page 30 Business Components......Page 31 Container Services......Page 32 Packaging......Page 34 Development Roles......Page 35 Application Component Provider......Page 36 Application Assembler......Page 37 Reference Implementation Software......Page 38 JDBC API 2.0......Page 39 Java Naming and Directory Interface 1.2......Page 40 Java API for XML Processing 1.1......Page 41 Simplified Systems Integration......Page 42 Scripts......Page 43 In This Chapter......Page 45 Getting the Build Tool (ant)......Page 46 Starting the deploytool......Page 47 Coding the Remote Interface......Page 48 Coding the Enterprise Bean Class......Page 49 Packaging the Enterprise Bean......Page 50 Locating the Home Interface......Page 52 Creating an Enterprise Bean Instance......Page 53 ConverterClient Source Code......Page 54 Packaging the J2EE Application Client......Page 55 Coding the Web Client......Page 56 Packaging the Web Client......Page 58 Specifying the JNDI Names......Page 59 Running the J2EETM Application Client......Page 61 Running the Web Client......Page 62 Modifying a Class File......Page 63 Modifying a Deployment Setting......Page 64 Incorrect XML Parser......Page 65 ant 1.4 Will Not Compile the Example after You Run the Client......Page 66 The Client Throws a NoClassDefFoundError......Page 67 The J2EE Application Has Not Been Deployed......Page 68 Detecting Problems With the Verifier Tool......Page 69 When All Else Fails......Page 70 In This Chapter......Page 71 Benefits of Enterprise Beans......Page 72 What Is a Session Bean?......Page 73 Stateless Session Beans......Page 74 What Is an Entity Bean?......Page 75 Primary Key......Page 76 Abstract Schema......Page 77 Direction in Container-Managed Relationships......Page 79 What Is a Message-Driven Bean?......Page 80 When to Use Message-Driven Beans......Page 81 Remote Access......Page 82 Local Interfaces and Container-Managed Relationships......Page 83 Deciding on Remote or Local Access......Page 84 Granularity of Accessed Data......Page 85 The Contents of an Enterprise Bean......Page 86 The Life Cycles of Enterprise Beans......Page 87 The Life Cycle of a Stateful Session Bean......Page 88 The Life Cycle of an Entity Bean......Page 89 The Life Cycle of a Message-Driven Bean......Page 91 In This Chapter......Page 93 Session Bean Class......Page 94 The ejbCreate Methods......Page 96 Business Methods......Page 97 Home Interface......Page 99 Running the CartEJB Example......Page 100 Accessing Environment Entries......Page 102 Passing an Enterprise Bean’s Object Reference......Page 104 In This Chapter......Page 107 The SavingsAccountEJB Example......Page 108 The ejbCreate Method......Page 109 The ejbRemove Method......Page 111 The ejbLoad and ejbStore Methods......Page 112 The Finder Methods......Page 113 The Business Methods......Page 115 The Home Methods......Page 116 Home Interface......Page 118 Finder Method Definitions......Page 119 Remote Interface......Page 120 Setting Up the Database......Page 121 Running the Client......Page 122 One-to-One Relationships......Page 123 Running the StorageBinEJB Example......Page 126 A Helper Class for the Child Table......Page 127 Running the OrderEJB Example......Page 130 An Entity Bean for the Child Table......Page 131 Many-to-Many Relationships......Page 134 Running the EnrollerEJB Example......Page 136 The Primary Key Class......Page 137 Primary Keys in the Entity Bean Class......Page 138 Getting the Primary Key......Page 139 Handling Exceptions......Page 140 In This Chapter......Page 143 Overview of the RosterApp Application......Page 144 The PlayerEJB Code......Page 145 Differences between Container-Managed and Bean- Managed Code......Page 146 Access Methods......Page 147 Select Methods......Page 148 Business Methods......Page 149 Local Home Interface......Page 150 RosterApp......Page 152 JNDI Names Tab (RosterApp)......Page 153 RosterEJB......Page 154 Relationships Tab (TeamJAR)......Page 155 PlayerEJB......Page 158 1. RosterClient......Page 161 1. RosterClient......Page 162 3. TeamEJB......Page 163 2. RosterEJB......Page 164 2. RosterEJB......Page 165 3. TeamEJB......Page 166 2. RosterEJB......Page 167 3. TeamEJB......Page 168 3. PlayerEJB......Page 169 3. PlayerEJB......Page 170 Setting Up......Page 171 deploytool Tips for Entity Beans With Container-Managed Persistence......Page 172 Defining EJB QL Queries for Finder and Select Methods......Page 173 Specifying the Database JNDI Name, User Name, and Password......Page 174 The Primary Key Class......Page 175 Primary Keys in the Entity Bean Class......Page 176 Generating Primary Key Values......Page 177 In This Chapter......Page 179 Example Application Overview......Page 180 The J2EETM Application Client......Page 181 The onMessage Method......Page 182 Deploying the Application......Page 183 deploytool Tips for Message-Driven Beans......Page 184 Setting the Message-Driven Bean’s Characteristics......Page 185 deploytool Tips for JMS Clients......Page 186 Specifying the JNDI Names......Page 187 In This Chapter......Page 189 Terminology......Page 190 Simple Finder Queries......Page 191 Finder Queries That Navigate to Related Beans......Page 193 Finder Queries with Other Conditional Expressions......Page 194 Select Queries......Page 196 BNF Grammar of EJB QL......Page 197 FROM Clause......Page 200 Identification Variables......Page 201 Path Expressions......Page 203 Examples......Page 204 Navigation......Page 205 Literals......Page 206 Conditional Expressions......Page 207 BETWEEN Expressions......Page 208 LIKE Expressions......Page 209 Collection Member Expressions......Page 210 Functional Expressions......Page 211 NULL Values......Page 212 Equality Semantics......Page 213 Return Types......Page 214 EJB QL Restrictions......Page 215 Web Clients and Components......Page 217 Web Client Life Cycle......Page 218 Web Application Archives......Page 220 Creating a WAR File......Page 221 Adding a Web Component to a WAR File......Page 222 Context Parameters......Page 224 Error Mapping......Page 225 Initialization Parameters......Page 226 Deploying Web Clients......Page 227 Updating Web Clients......Page 228 Internationalizing Web Clients......Page 230 In This Chapter......Page 233 What Is a Servlet?......Page 234 The Example Servlets......Page 235 Troubleshooting......Page 239 Defining The Listener Class......Page 240 Sharing Information......Page 242 Using Scope Objects......Page 243 Controlling Concurrent Access to Shared Resources......Page 244 Accessing Databases......Page 245 Initializing a Servlet......Page 246 Getting Information from Requests......Page 247 Constructing Responses......Page 249 Filtering Requests and Responses......Page 252 Programming Filters......Page 253 Programming Customized Requests and Responses......Page 255 Specifying Filter Mappings......Page 257 Including Other Resources in the Response......Page 259 Transferring Control to Another Web Component......Page 261 Accessing the Web Context......Page 262 Associating Attributes with a Session......Page 263 Session Management......Page 264 Session Tracking......Page 265 Tracking Service Requests......Page 266 Notifying Methods to Shut Down......Page 267 Creating Polite Long-Running Methods......Page 268 In This Chapter......Page 269 What Is a JSP Page?......Page 270 The Example JSP Pages......Page 273 Translation and Compilation......Page 277 Execution......Page 278 Handling Errors......Page 279 Initializing and Finalizing a JSP Page......Page 280 Using Objects within JSP Pages......Page 281 Implicit Objects......Page 282 Shared Objects......Page 283 Declarations......Page 284 Scriptlets......Page 285 Expressions......Page 286 Including Content in a JSP Page......Page 287 Transferring Control to Another Web Component......Page 288 Including an Applet......Page 289 Extending the JSP Language......Page 291 In This Chapter......Page 293 JavaBeans Component Design Conventions......Page 294 Why Use a JavaBeans Component?......Page 295 Creating and Using a JavaBeans Component......Page 296 Setting JavaBeans Component Properties......Page 297 Retrieving JavaBeans Component Properties......Page 299 Custom Tags in JSPTM Pages......Page 303 What is a Custom Tag?......Page 304 The Example JSP Pages......Page 305 Declaring Tag Libraries......Page 309 Tags With Attributes......Page 310 Tags That Define Scripting Variables......Page 311 Cooperating Tags......Page 312 Tag Handlers......Page 313 Tag Library Descriptors......Page 314 listener Element......Page 315 tag Element......Page 316 body-content Element......Page 317 attribute Element......Page 318 Attribute Validation......Page 319 Tag Handlers......Page 320 Tag Handlers......Page 322 Providing Information about the Scripting Variable......Page 323 Cooperating Tags......Page 326 JSP Page......Page 328 Tag Handler......Page 329 Tag Extra Info Class......Page 331 JSP Page......Page 332 Tag Handlers......Page 334 How Is a Tag Handler Invoked?......Page 337 In This Chapter......Page 339 Container-Managed Transactions......Page 340 Transaction Attributes......Page 341 NotSupported......Page 342 Summary of Transaction Attributes......Page 343 Setting Transaction Attributes......Page 344 Rolling Back a Container-Managed Transaction......Page 345 Synchronizing a Session Bean’s Instance Variables......Page 346 Bean-Managed Transactions......Page 347 JDBC Transactions......Page 348 JTA Transactions......Page 349 Returning without Committing......Page 350 Summary of Transaction Options for Enterprise Beans......Page 351 Transaction Timeouts......Page 352 Updating Multiple Databases......Page 353 Transactions in Web Components......Page 355 In This Chapter......Page 357 Overview......Page 358 Declaring and Linking Role References......Page 359 Protecting Web Resources......Page 361 Form-Based Authentication......Page 362 Configuring Web Resources’ Authentication Mechanism......Page 363 Unprotected Web Resources......Page 364 Using Programmatic Security in the EJB Tier......Page 365 Application Client-Tier Security......Page 366 EIS-Tier Security......Page 367 Component-Managed Sign-On......Page 368 Configuring Resource Adapter Security......Page 369 Propagating Security Identity......Page 370 Configuring Client Authentication......Page 371 J2EE Users, Realms, and Groups......Page 372 Managing J2EE Users and Groups......Page 373 Setting Up a Server Certificate......Page 374 JNDI Names and Resource References......Page 377 Specifying a Resource Reference......Page 378 Mapping a Resource Reference to a JNDI Name......Page 379 Database Connections for Enterprise Beans......Page 380 When to Connect......Page 381 deploytool Tips for Specifying Database Users and Passwords......Page 382 Mail Session Connections......Page 383 Running the Client......Page 385 URL Connections......Page 386 Running the Client......Page 387 In This Chapter......Page 389 Resource Adapter Contracts......Page 390 Administering Resource Adapters......Page 392 Transaction Levels......Page 393 Properties......Page 394 The XA Black Box Adapters......Page 395 Deploying the Resource Adapter......Page 396 Testing the Resource Adapter......Page 397 Overview of the CCI......Page 399 Programming with the CCI......Page 401 Database Stored Procedures......Page 403 Mapping to Stored Procedure Parameters......Page 404 Reading Database Records......Page 406 Inserting Database Records......Page 408 Deploying the Resource Adapter......Page 410 Setting Up the Database......Page 411 Browsing the CoffeeApp Application......Page 412 Deploying and Running the CoffeeApp Application......Page 414 The Duke’s Bank Application......Page 415 Enterprise Beans......Page 417 AccountControllerEJB......Page 418 TxControllerEJB......Page 420 Helper Classes......Page 421 Tables Representing Business Entities......Page 422 Tables That Hold the Next Primary Key......Page 423 Application Client......Page 424 The Classes and Their Relationships......Page 426 main Method......Page 427 EventHandle Class......Page 428 hookupEvents Method......Page 429 Constructor......Page 430 Methods......Page 431 Web Client......Page 433 Design Strategies......Page 434 Initializing the Client Components......Page 435 Request Processing......Page 436 Internationalization......Page 439 Adding Groups and Users to the Realm......Page 441 J2EE Server......Page 442 Packaging the Enterprise Beans......Page 443 Compiling the J2EE Application Client......Page 444 Opening the Enterprise Archive File......Page 445 Reviewing JNDI Names......Page 447 Mapping the Security Roles to Groups......Page 449 Creating the Bank Database......Page 450 Running the J2EE Application Client......Page 451 Running the Web Client......Page 452 In This Appendix......Page 455 HTTP Responses......Page 456 In This Appendix......Page 457 J2EE Administration Tool......Page 458 Cloudscape Server......Page 459 Running the Interactive SQL Tool......Page 460 Cloudscape Server Configuration......Page 461 Deployment Tool......Page 462 Key Tool......Page 463 Example......Page 464 Example......Page 465 Example......Page 466 Example......Page 467 Examples......Page 468 Syntax......Page 469 Accessing a Remote Server......Page 470 Command-Line Verifier......Page 471 Stand-Alone GUI Verifier......Page 472 Examples......Page 473 Glossary......Page 477 Biographies......Page 501 Index......Page 503 Sun's hands-on, start-to-finish J2EE 1.3 introduction for every Java developer!
دانلود کتاب The J2Ee Tutorial (Java Series)
- Gentle, self-paced introductions to servlets, JSP, JDBC, EJBs, XML, JMS, JNDI, and many other key topics.
- Follows the same approach and format that made The JavaTMTM Tutorial a worldwide best-seller!
- Includes CD-ROM containing all content, examples, and both the J2EE and J2SE Version 1.3 software platforms.
About the Authors: Stephanie Bodoff, Dale Green, Eric Jendrock, and Monica Pawlan are senior writers at Sun working closely with the architects of Sun's J2EE technologies. Beth Stearns is principal partner of ComputerEase Publishing, a consulting firm she founded in 1982. Her client list includes Sun Microsystems, Silicon Graphics, Oracle, and Xerox.
Annotation You're familiar with Java programming, but now it's time for you to take it to the next level and begin creating enterprise applications with the Java 2 Platform, Enterprise Edition (J2EE). "The J2EE Tutorial is the hands-on, example-driven guide that offers unparalleled technical guidance into developing and deploying applications on the J2EE platform. Written by the uniquely qualified members of the Java Software team at Sun Microsystems, "The J2EE Tutorial uses the same effective interactive approach as the successful Java Tutorial collection. Throughout this book's development, hundreds of suggestions and volumes of feedback from both users and architects were integrated to ensure great writing and truly useful guidance. Inside you'll find a smart mix of example programs--including source code--that are used to illustrate key J2EE concepts. In addition, clear explanations will help you make easy work of the range of technologies collected into the J2EE platform, including: Enterprise JavaBeans Java ServletsJavaServer Pages Java Message Service (JMS)Java Naming and Directory Interface (JNDI)XMLJ2EE Connector ArchitectureJavaMail JDBC When you're ready to create your own great enterprise applications, turn to the unmatched guidance, understanding, and experience you'll find only in "The J2EE Tutorial. The accompanying CD-ROM is filled with a wealth of valuable resources, including all three Java Tutorial books, the J2SE 1.3.1 and J2EE 1.3.1 software development kits, the Java BluePrints sample application and book, and Forte for Java Plugin for the J2EE SDK. 0201791684B03012002