Skip Headers
Oracle® Containers for J2EE Servlet Developer's Guide
10g Release 3 (10.1.3)
B14426-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Index
Index

Next
Next
 

Contents

List of Figures

List of Tables

Title and Copyright Information

Send Us Your Comments

Preface

Audience
Documentation Accessibility
Related Documentation
Conventions

1 Summary of What to Know About Servlets

Summary of Servlet and J2EE Technology
The Essence of Servlets
Why Use Servlets?
Servlet Lifecycle
JSP Pages and Other J2EE Component Types
Key Components and APIs of the Servlet Model
Key Methods of the Servlet Interface
Servlet Communication: Request and Response Objects
Key Methods of the HttpServletRequest Interface
Key Methods of the HttpServletResponse Interface
Servlet Execution in the Servlet Container
Servlet Configuration Objects
Obtaining a Servlet Configuration Object
Key Servlet Configuration Methods
Servlet Contexts: the Application Container
Servlet Context Basics
Obtaining a Servlet Context
Key Servlet Context Methods
What are Servlet Sessions (User Sessions) Used For?
Servlet Thread Models
Servlet Feature Table

2 Developing Servlets

Writing a Basic Servlet
When to Implement Methods of the Servlet Interface
When to Override the init() Method
When to Override the doGet() or doPost() Method
When to Override the doPut() Method
When to Override the doDelete() Method
When to Override the getServletInfo() Method
When to Override the destroy() Method
Setting Up the Response
Step-by-Step Through a Simple Servlet
Simple Servlet Example
Write the Sample Code
Compile the Sample Code
Using HTML Forms and Request Parameters
Using an HTML Form for User Input
Displaying Request Parameter Data Specified in User Input
Complete Example Using a Form and Request Parameters
Using the POST Method for URL Security
Calling Information Methods of the Request Object
Complete Example Retrieving Request Information
Dispatching to Other Servlets Through Includes and Forwards
Basics of Includes and Forwards
Why Use Includes and Forwards?
Step-by-Step Through the Include or Forward Process
Complete Example of a Servlet Include
When to Use Filters for Pre-Processing and Post-Processing
When to Use Event Listeners for Servlet Notification

3 Deploying and Invoking Servlets

Initial Considerations and OC4J Scenarios
A Brief Overview of OC4J Administration
OC4J in a Standalone Versus Oracle Application Server Environment
OC4J and Oracle Application Server Administration Tools
Summary of URL Components
Deploying a Web Application to OC4J
Application Structure
Summary of General Steps to Deploy a WAR File
Summary of General Steps to Deploy an EAR File
Invoking a Servlet in OC4J
Invoking a Servlet in a Standalone OC4J Environment
Invoking a Servlet by Class Name During OC4J Development
Invoking a Servlet in an Oracle Application Server Environment
Deploying and Invoking the Simple Servlet Example
Deploy the Servlet Example as a WAR File
Create the web.xml File
Create the WAR File
Deploy the WAR File and Bind the Web Application
Deploy the Servlet Example as an EAR File
Create the web.xml File and WAR file.
Create the application.xml File
Create the EAR File
Deploy the EAR File and Bind the Contained Web Application
Invoke the Servlet Example
Preloading Servlets

4 Understanding and Using Servlet Sessions

Overview of Session Tracking
Session Objects
Session IDs
Cookies and Persistent Session Data
When to Use Cookies Versus Session Attributes
Using Session Tracking in OC4J
Configuring Session Tracking and Enabling or Disabling Cookies in OC4J
How OC4J Can Use Cookies for Session Tracking
Using URL Rewriting for Session Tracking
Session Tracking Through Secured Connections
Using a Session Object in Your Servlet
Summary of HttpSession Methods
Adding and Retrieving Session Attributes
Session Object Example
Using Cookies in Your Servlet
Configuring Cookies
Summary of Cookie Methods
Retrieving, Displaying, and Adding Cookies
Cookie Example
Canceling a Session
Using a Timeout to Cancel a Session
Explicitly Canceling a Session

5 Understanding and Using Servlet Filters

Overview of How Filters Work
How the Servlet Container Invokes Filters
Typical Filter Actions
Standard Filter Interfaces
Methods of the Filter Interface
Method of the FilterChain Interface
Methods of the FilterConfig Interface
Implementing and Configuring Filters
Implement the Filter Code
Configure the Filter
Construction of the Filter Chain
Simple Filter Example
Write the Simple Filter Code
Write the Target JSP Page
Configure the Simple Filter
Package the Simple Filter Example
Invoke the Simple Filter Example
Filtering Forward or Include Targets
The web.xml <dispatcher> Element
Configuring Filters for Forward or Include Targets
Using a Filter to Wrap and Alter the Request or Response
Response Filter Example
Write the Custom Output Stream Code
Write the Response Wrapper Code
Write the Base Filter Code
Write the Response Filter Code
Write the Target HTML Page
Configure the Response Filter
Package the Response Filter Example
Invoke the Response Filter Example

6 Understanding and Using Event Listeners

Overview of How Event Listeners Work
Event Listener Interfaces
ServletContextListener Methods, ServletContextEvent Class
ServletContextAttributeListener Methods, ServletContextAttributeEvent Class
HttpSessionListener Methods, HttpSessionEvent Class
HttpSessionAttributeListener Methods, HttpSessionBindingEvent Class
HttpSessionActivationListener Methods
HttpSessionBindingListener Methods
ServletRequestListener Methods, ServletRequestEvent Class
ServletRequestAttributeListener Methods, ServletRequestAttributeEvent Class
Implementing and Configuring Event Listeners
Implement the Listener Code
Configure the Listener
Session Lifecycle Listener Example
Write the JSP Welcome Page
Write the Session Creation Servlet
Write the Session Invalidation Servlet
Write the Session Lifecycle Listener Code
Configure the Session Lifecycle Listener Example
Package the Session Lifecycle Listener Example
Invoke the Session Lifecycle Listener Example

7 Using JDBC or Enterprise JavaBeans

Using JDBC in Servlets
Why Use JDBC?
Configuring a Data Source and Resource Reference
Configure the Data Source
Configure the Resource Reference
Implementing JDBC Calls
Database Query Servlet Example
Configure the Data Source for the Query Servlet
Write the HTML Welcome Page
Write the Query Servlet
Configure the Servlet and JNDI Resource Reference
Package the Query Example
Invoke the Query Example
Overview of Enterprise JavaBeans
Why Use Enterprise JavaBeans?
EJB Support in OC4J and Oracle Application Server
Servlet-EJB Lookup Scenarios
EJB Local Interfaces Versus Remote Interfaces
Using the Remote Flag for Remote Lookup within the Same Application

8 Best Practices and Performance

Best Practices for Sessions
Best Practices for Security
Considerations for Thread Models
Best Practices for Performance
Monitoring Performance
Oracle Application Server Dynamic Monitoring Service

A Web Module Administration

Application Server Control Console Top-Level Web Module Pages
How to Get to a Web Module Home Page
Summary of Top-Level Web Module Pages
Application Server Control Web Module Configuration Pages
Configuration Properties Page
Deployment Descriptor Viewing Pages
Servlet Mappings Page
Filter Mappings Page
Resource Reference Mappings Page
EJB Reference Mappings Page
Environment Entry Mappings Page
Resource Reference Lookup Context Page
Summary of Web Module MBeans and Administration
General Overview of OC4J MBean Administration
Summary of OC4J Web Module MBeans

B Web Module Configuration Files

Overview of Web Application Configuration Files
Standard web.xml Configuration File
Oracle global-web-application.xml Configuration File
Oracle orion-web.xml Configuration File
Summary of Relationship Between Web Application Configuration Files
Hierarchy of orion-web.xml and global-web-application.xml
Elements and Attributes of orion-web.xml, global-web-application.xml
<access-mask>
<classpath>
<context-attribute>
<context-param-mapping>
<ejb-ref-mapping>
<env-entry-mapping>
<expiration-setting>
<group>
<host-access>
<ip-access>
<jazn-web-app>
<lookup-context>
<mime-mappings>
<orion-web-app>
<request-tracker>
<resource-env-ref-mapping>
<resource-ref-mapping>
<security-role-mapping>
<service-ref-mapping>
<servlet-chaining>
<session-tracker>
<session-tracking>
<user>
<virtual-directory>
<web-app>
<web-app-class-loader>

C Third Party Licenses

ANTLR
The ANTLR License
Apache
The Apache Software License
Apache SOAP
Apache SOAP License

Index