Oracle9ias Containers for J2EE

Oracle9ias Containers for J2EE

Oracle9iAS Containers for J2EE Servlet Developer’s Guide Release 2 (9.0.2) January 2002 Part No. A95878-01 Oracle9iAS Containers for J2EE Servlet Developer’s Guide, Release 2 (9.0.2) Part No. A95878-01 Copyright © 2002 Oracle Corporation. All rights reserved. Primary Authors: Brian Wright, Tim Smith Contributors: Jasen Minton, Joyce Yang, Sunil Kunisetty, Bryan Atsatt, Ashok Banerjee, Charlie Shapiro, Philippe Le Mouel, Paolo Ramasso, Olaf Heimburger, Sheryl Maring, Mike Sanko, Ellen Barnes The Programs (which include both the software and documentation) contain proprietary information of Oracle Corporation; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent and other intellectual and industrial property laws. Reverse engineering, disassembly or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. Oracle Corporation does not warrant that this document is error-free. Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Oracle Corporation. If the Programs are delivered to the U.S. Government or anyone licensing or using the programs on behalf of the U.S. Government, the following notice is applicable: Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial computer software" and use, duplication, and disclosure of the Programs, including documentation, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement. Otherwise, Programs delivered subject to the Federal Acquisition Regulations are "restricted computer software" and use, duplication, and disclosure of the Programs shall be subject to the restrictions in FAR 52.227-19, Commercial Computer Software - Restricted Rights (June, 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065. The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and Oracle Corporation disclaims liability for any damages caused by such use of the Programs. Oracle is a registered trademark, and Oracle9i,Oracle8i, Oracle8, Oracle7, PL/SQL, SQL*Net, SQL*Plus, and Oracle Store are trademarks or registered trademarks of Oracle Corporation. Other names may be trademarks of their respective owners. Contents Send Us Your Comments .................................................................................................................. vii Preface............................................................................................................................................................ ix Intended Audience ................................................................................................................................. x Documentation Accessibility ................................................................................................................ x Organization ........................................................................................................................................... xi Related Documentation ........................................................................................................................ xi Conventions.......................................................................................................................................... xiv 1 Servlet Overview Information Sources........................................................................................................................... 1-2 Servlet Information....................................................................................................................... 1-2 Additional OC4J Documents ...................................................................................................... 1-2 Introduction to Servlets..................................................................................................................... 1-3 Advantages of Servlets ................................................................................................................ 1-3 Servlets and the Servlet Container ............................................................................................. 1-4 Request Objects, Response Objects, and Filters ....................................................................... 1-5 Session Tracking ........................................................................................................................... 1-6 A First Servlet Example ..................................................................................................................... 1-7 Hello World Code......................................................................................................................... 1-7 Compiling and Deploying the Servlet....................................................................................... 1-8 Running the Servlet...................................................................................................................... 1-9 iii 2 Servlet Development Servlet Development Basics ............................................................................................................. 2-2 Code Template .............................................................................................................................. 2-2 Servlet Lifecycle ............................................................................................................................ 2-3 Servlet Behavior ............................................................................................................................ 2-3 Invoking a Servlet............................................................................................................................... 2-5 Action by the Servlet Container Upon Request ....................................................................... 2-5 Invoking a Servlet by Class Name in OC4J............................................................................... 2-6 Configuration for Servlet Invocation in a Deployment Environment .................................. 2-7 Servlet Loading and Initialization................................................................................................... 2-9 Servlet Sessions................................................................................................................................. 2-10 Session Tracking ......................................................................................................................... 2-10 Session Cancellation ................................................................................................................... 2-11 Session Servlet Example ............................................................................................................ 2-12 Session Replication ..................................................................................................................... 2-15 Use of JDBC in Servlets................................................................................................................... 2-17 Database Query Servlet.............................................................................................................. 2-17 Deployment and Testing of the Database Query Servlet...................................................... 2-20 EJB Calls from Servlets .................................................................................................................... 2-23 Local EJB Lookup Within the Same Application ................................................................... 2-23 Remote EJB Lookup Within the Same Application ............................................................... 2-31 EJB Lookup Outside the Application....................................................................................... 2-31 3 Deployment and Configuration Introduction to Web Application Deployment and Configuration .......................................... 3-2 Web Application Modules........................................................................................................... 3-2 Overview of OC4J Deployment.................................................................................................. 3-3 Overview of Web Configuration Files....................................................................................... 3-3 Application Assembly ....................................................................................................................... 3-6 Application Directory Structure ................................................................................................. 3-6 Application Build Mechanisms .................................................................................................. 3-7 Application Deployment..................................................................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    118 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us