Skip Headers
Oracle® Containers for J2EE Support for JavaServer Pages Developer's Guide
10
g
(10.1.3.1.0)
Part Number B28961-01
Home
Book List
Index
Contact Us
Next
View PDF
Contents
List of Figures
List of Tables
Title and Copyright Information
Preface
Intended Audience
Documentation Accessibility
Related Documents
Conventions
1
Getting Started with JSP
A Brief Overview of JavaServer Pages Technology
What is JavaServer Pages Technology?
Key Advantages of JSP
How JSP Works
JSP Translation and Runtime Flow
Overview of JSP Syntax Elements
Directives
page directive
include directive
taglib directive
Scripting Elements
Declarations
Expressions
Scriptlets
Comments
JSP Objects and Scopes
Explicit Objects
Implicit Objects
Using an Implicit Object
Object Scopes
Standard JSP Action Tags
jsp:useBean tag
jsp:setProperty tag
jsp:getProperty tag
jsp:param tag
jsp:include tag
jsp:forward tag
jsp:plugin tag
Bean Property Conversions from String Values
Typical Property Conversions
Conversions for Property Types with Property Editors
Custom Tag Libraries
Simplified JSP Authoring with the Expression Language
Overview of the Expression Language Syntax
JSP Expression Language Syntax
Expression Language Implicit Objects
Additional Features of the Expression Language
Creating and Using Expression Language Functions
Disabling the Expression Language
Disabling EL in All JSPs in a Web Application
Disabling EL in a JSP
Disabling EL in a Tag File
JSP Execution Model
JSP Execution Models
On-Demand Translation Model
Pretranslation Model
JSP Pages and On-Demand Translation
Requesting a JSP Page
Directly Requesting a JSP Page
Indirectly Requesting a JSP Page
2
The Oracle JSP Implementation
Introduction to OC4J
What's New in OC4J
Support for Web Services
Support for New J2EE 1.4 Application Management and Deployment Specifications
Support for Oracle Application Server TopLink
OracleAS Job Scheduler
New Two-Phase Commit Transaction Coordinator Functionality
Generic JMS Resource Adapter Enhancements
Features of OC4J
J2EE Support
OC4J Web Communication
Clustering
Oracle Value-Added Features for JSP
Supported Specifications
Oracle-Specific Features
Configurable JSP Extensions in OC4J
Global Includes
Support for Dynamic Monitoring Service
JSP Utilities and Tag Libraries Provided with OC4J
Tags and API for Caching Support
Support for the JavaServer Pages Standard Tag Library (JSTL)
JSP Support in Oracle JDeveloper
Oracle JSP Resource Management Features
Standard Session Resource Management: HttpSessionBindingListener
The valueBound() and valueUnbound() Methods
JDBCQueryBean JavaBean Code
UseJDBCQueryBean JSP Page
Advantages of HttpSessionBindingListener
Overview of Oracle Value-Added Features for Resource Management
3
Configuring the OC4J JSP Environment
Configuring the OC4J JSP Container
Summary of JSP Configuration Parameters
Setting JSP Parameters in Application Server Control Console
Accessing Application Server Control Console in Standalone OC4J
Accessing Application Server Control Console in Oracle Application Server
Setting JSP Parameters in the XML Configuration Files
Setting Servlet Initialization Parameters
Setting JSP Configuration Parameters
Configuring JSP Compilation in OC4J
Configuring Runtime JSP Retranslation and Reloading in OC4J
Key JSP-Related Support Files Provided with OC4J
4
Precompiling JSP Pages with ojspc
How the ojspc Utility Works
Overview of Basic ojspc Functionality
Overview of Batch Pretranslation of WAR Files
Using ojspc
Precompiling One or More JSPs
Precompiling JSPs within a WAR File
Using an Ant Task to Precompile a JSP
Summary of ojspc Command Line Options
5
Understanding JSP Translation in OC4J
Features of Generated Code
General Conventions for Output Names
Generated Package and Class Names
Generated Files and Locations
Oracle JSP Global Includes
Global Includes File and Examples
The ojsp-global-include.xml File
Global Include Examples
6
Working with JSP
Before You Start
Understanding Application Root Functionality
Understanding OC4J Classpath Functionality
Packages Imported By Default in OC4J
JDK1.4 Issue: Classes Not in Packages Cannot Be Invoked
General JSP Programming Strategies
Creating Traditional Versus Scriptless JSP
Using JavaBeans Versus Scriptlets
Using Static Includes Versus Dynamic Includes
Logistics of Static Includes
Logistics of Dynamic Includes
Advantages, Disadvantages, and Typical Uses of Dynamic and Static Includes
Using Annotations in JSP Tag Libraries for Services and Resource References
Monitoring Your JSP Application
Managing Heavy Static Content or Tag Library Usage
Using Method Variable Declarations Versus Member Variable Declarations
Working with Page Directives
Page Directives Are Static
Duplicate Settings of Page Directive Attributes Are Disallowed
Workarounds for the 64K Size Limit for Generated Methods
Following JSP File Naming Conventions
Understanding JSP Preservation of White Space and Use with Binary Data
White Space Examples
Reasons to Avoid Binary Data in JSP Pages
JSP Best Practices
Beware of HTTP Sessions
Avoid Using HTTP Sessions If Not Required
Always Invalidate Sessions When No Longer In Use
Pre-translate JSP Pages Using the ojspc Utility
Ensure Updated Objects Are Re-set on HTTP Sessions
Un-Buffer JSP Pages
Forward to JSP Pages Instead of Using Redirects
Hide JSP Pages from Direct Invocation to Limit Access
Use JSP-Timeout for Efficient Memory Utilization
Package JSP Files In EAR File For Deployment
Disable Dynamic Charset Check for Performance Improvement
Use Quotes Correctly in JSP Files
Working with Servlets
Invoking a Servlet from a JSP Page
Passing Data to a Servlet Invoked from a JSP Page
Invoking a JSP Page from a Servlet
Passing Data Between a JSP Page and a Servlet
JSP-Servlet Interaction Samples
Code for Jsp2Servlet.jsp
Code for MyServlet.java
Code for welcome.jsp
Migrating JSP Pages from Apache Tomcat to OC4J
Introduction
Migration Approach
Migrating a Simple JSP Page
Precompiling JSP Pages
Processing Runtime Errors
Servlet and JSP Runtime Error Mechanisms
General Servlet Runtime Error Mechanism
JSP Error Pages
JSP Error Page Example
Code for nullpointer.jsp
Code for myerror.jsp
7
Working with Custom Tags
What Are Custom Tags?
Available Tag Libraries
When Should You Consider Creating/Using Custom Tag Libraries?
Eliminating Extensive Java Logic
Providing Convenient JSP Programming Access to API Features
Manipulating or Redirecting JSP Output
Working with Tag Handlers
What Are Classic Tag Handlers?
Classic Tag Handler Interfaces
Custom Tag Processing, with or without Tag Bodies
Tag Handlers That Access Body Content
What Are Simple Tag Handlers?
The SimpleTag Interface
Using Attributes
Attribute Handling and Conversions from String Values in Tag Handlers
Using Scripting Variables in Tags
Scripting Variable Scopes
Variable Declaration Through TLD <variable> Elements
Variable Declaration Through Tag-Extra-Info Classes
Access to Outer Tag Handler Instances
Implementing a Tag Handler
Creating the Tag Handler Class
Defining the Tag in the TLD
Declaring the Tag in a JSP Page
Using the Tag in a JSP
OC4J Tag Handler Features
Disabling or Enabling Tag Handler Reuse (Tag Pooling)
Enabling or Disabling the Compile-Time Model for Tag Handler Reuse
When Can the Compile-Time Tag Pooling Model Be Used?
Code Pattern for the compiletime Tag Pooling Model
Code Pattern for the compiletime-with-release Tag Pooling Model
Tag Handler Code Generation
Working with Tag Files
What Are Tag Files?
Tag Body Processing
Using Attributes in Tag Files
Exposing Data through Variables in Tag Files
Using JSP Fragments
Creating a JSP Fragment
A Tag File Example
Implementing a Tag File
Creating the Tag File
Packaging Tag Files
Declaring the Tag File in a JSP
Sharing Tag Libraries Across Web Applications
Packaging Multiple Tag Libraries and TLD Files in a JAR File
Key TLD File Entries
Key web.xml Deployment Descriptor Entries
JSP Page taglib Directives for Multiple-Library Example
Specifying Well-Known Tag Library Locations
Enabling the TLD Caching Feature
Understanding the TLD Cache Features and Files
8
Understanding JSP XML Support in OC4J
Introducing JSP Documents and XML Views
Working with JSP Documents
Specifying a Document Root Element
Declaring Tag Libraries with XML Namespaces
Using JSP XML Directive Elements
Example: page Directive
Example: include Directive
Using JSP XML Declaration, Expression, and Scriptlet Elements
Example: JSP Declaration
Example: JSP Expression
Example: JSP Scriptlet
Using JSP XML Standard Action and Custom Action Elements
Including Template and Dynamic Template Content
Sample Comparison: Traditional JSP Page Versus JSP XML Document
Sample Traditional JSP Page
Sample JSP Document
Understanding the JSP XML View
Transformation from a JSP Page to the XML View
The jsp:id Attribute for Error Reporting During Validation
Example: Transformation from Traditional JSP Page to XML View
Traditional JSP Page
XML View of JSP Page
9
JSP Globalization Support in Oracle
Content Type Settings
Content Type Settings in the page Directive
Dynamic Content Type Settings
Oracle Extension for the Character Set of the JSP Writer Object
JSP Support for Multibyte Parameter Encoding
Standard setCharacterEncoding() Method
A
Third Party Licenses
Apache
The Apache Software License
License
Notice
Index