| |
| |
Acknowledgments | |
| |
| |
About the Authors | |
| |
| |
Introduction | |
| |
| |
Who Should Read This Book | |
| |
| |
Volume 2 | |
| |
| |
Distinctive Features | |
| |
| |
How This Book Is Organized | |
| |
| |
Conventions | |
| |
| |
About the Web Site | |
| |
| |
| |
An Overview of Servlet and JSP Technology | |
| |
| |
| |
A Servlet's Job | |
| |
| |
| |
Why Build Web Pages Dynamically? | |
| |
| |
| |
A Quick Peek at Servlet Code | |
| |
| |
| |
The Advantages of Servlets Over "Traditional" CGI | |
| |
| |
| |
The Role of JSP | |
| |
| |
| |
Servlet Technology | |
| |
| |
| |
Server Setup and Configuration | |
| |
| |
| |
Download and Install the Java Software Development Kit (SDK) | |
| |
| |
| |
Download a Server for Your Desktop | |
| |
| |
| |
Configure the Server | |
| |
| |
| |
Configuring Apache Tomcat | |
| |
| |
| |
Configuring Macromedia JRun | |
| |
| |
| |
Configuring Caucho Resin | |
| |
| |
| |
Set Up Your Development Environment | |
| |
| |
| |
Test Your Setup | |
| |
| |
| |
Establish a Simplified Deployment Method | |
| |
| |
| |
Deployment Directories for Default Web Application: Summary | |
| |
| |
| |
Web Applications: A Preview | |
| |
| |
| |
Servlet Basics | |
| |
| |
| |
Basic Servlet Structure | |
| |
| |
| |
A Servlet That Generates Plain Text | |
| |
| |
| |
A Servelt That Generates HTML | |
| |
| |
| |
Servlet Packaging | |
| |
| |
| |
Simple HTML-Building Utilities | |
| |
| |
| |
The Servlet Life Cycle | |
| |
| |
| |
The Single ThreadModel Interface | |
| |
| |
| |
Servlet Debugging | |
| |
| |
| |
Handling the Client Request: Form Data | |
| |
| |
| |
The Role of Form Data | |
| |
| |
| |
Reading Form Data from Servlets | |
| |
| |
| |
Example: Reading Three Parameters | |
| |
| |
| |
Example: Reading All Parameters | |
| |
| |
| |
Using Default Values When Parameters Are Missing or Malformed | |
| |
| |
| |
Filtering Strings for HTML-Specific Characters | |
| |
| |
| |
Automatically Populating Java Objects from Request Parameters: Form Beans | |
| |
| |
| |
Redisplaying the Input Form When Parameters Are Missing or Malformed | |
| |
| |
| |
Handling the Client Request: HTTP Request Headers | |
| |
| |
| |
Reading Request Headers | |
| |
| |
| |
Making a Table of All Request Headers | |
| |
| |
| |
Understanding HTTP 1.1 Request Headers | |
| |
| |
| |
Sending Compressed Web Pages | |
| |
| |
| |
Differentiating Among Different Browser Types | |
| |
| |
| |
Changing the Page According to How the User Got There | |
| |
| |
| |
Accessing the Standard CGI Variables | |
| |
| |
| |
Generating the Server Response: HTTP Status Codes | |
| |
| |
| |
Specifying Status Codes | |
| |
| |
| |
HTTP 1.1 Status Codes | |
| |
| |
| |
A Servlet That Redirects Users to Browser-Specific Pages | |
| |
| |
| |
A Front End to Various Search Engines | |
| |
| |
| |
Generating the Server Response: HTTP Response Headers | |
| |
| |
| |
Setting Response Headers from Servlets | |
| |
| |
| |
Understanding HTTP 1.1 Response Headers | |
| |
| |
| |
Building Excel Spreadsheets | |
| |
| |
| |
Persistent Servlet State and Auto-Reloading Pages | |
| |
| |
| |
Using Servlets to Generate JPEG Images | |
| |
| |
| |
Handling Cookies | |
| |
| |
| |
Benefits of Cookies | |
| |
| |
| |
Some Problems with Cookies | |
| |
| |
| |
Deleting Cookies | |
| |
| |
| |
Sending and Receiving Cookies | |
| |
| |
| |
Using Cookies to Detect First-Time Visitors | |
| |
| |
| |
Using Cookie Attributes | |
| |
| |
| |
Differentiating Session Cookies from Persistent Cookies | |
| |
| |
| |
Basic Cookie Utilities | |
| |
| |
| |
Putting the Cookie Utilities into Practice | |
| |
| |
| |
Modifying Cookie Values: Tracking User Access Counts | |
| |
| |
| |
Using Cookies to Remember User Preferences | |
| |
| |
| |
Session Tracking | |
| |
| |
| |
The Need for Session Tracking | |
| |
| |
| |
Session Tracking Basics | |
| |
| |
| |
The Session-Tracking API | |
| |
| |
| |
Browser Sessions vs. Server Sessions | |
| |
| |
| |
Encoding URLs Sent to the Client | |
| |
| |
| |
A Servlet That Shows Per-Client Access Counts | |
| |
| |
| |
Accumulating a List of User Data | |
| |
| |
| |
An On-Line Store with a Shopping Cart and Session Tracking | |
| |
| |
| |
JSP Technology | |
| |
| |
| |
Overview of JSP Technology | |
| |
| |
| |
The Need for JSP | |
| |
| |
| |
Benefits of JSP | |
| |
| |
| |
Advantages of JSP Over Competing Technologies | |
| |
| |
| |
Misconceptions About JSP | |
| |
| |
| |
Installation of JSP Pages | |
| |
| |
| |
Basic Syntax | |
| |
| |
| |
Invoking Java Code with JSP Scripting Elements | |
| |
| |
| |
Creating Template Text | |
| |
| |
| |
Invoking Java Code from JSP | |
| |
| |
| |
Limiting the Amount of Java Code in JSP Pages | |
| |
| |
| |
Using JSP Expressions | |
| |
| |
| |
Example: JSP Expressions | |
| |
| |
| |
Comparing Servlets to JSP Pages | |
| |
| |
| |
Writing Scriptlets | |
| |
| |
| |
Scriptlet Example | |
| |
| |
| |
Using Scriptlets to Make Parts of the JSP Page Conditional | |
| |
| |
| |
Using Declarations | |
| |
| |
| |
Declaration Example | |
| |
| |
| |
Using Predefined Variables | |
| |
| |
| |
Comparing JSP Expressions, Scriptlets, and Declarations | |
| |
| |
| |
Controlling the Structure of Generated Servlets: The JSP Page Directive | |
| |
| |
| |
The import Attribute | |
| |
| |
| |
The contentType and pageEncoding Attributes | |
| |
| |
| |
Conditionally Generating Excel Spreadsheets | |
| |
| |
| |
The session Attribute | |
| |
| |
| |
The isELIgnored Attribute | |
| |
| |
| |
The buffer and autoFlush Attributes | |
| |
| |
| |
The info Attribute | |
| |
| |
| |
The errorPage and isErrorPage Attributes | |
| |
| |
| |
The is ThreadSafe Attribute | |
| |
| |
| |
The extends Attribute | |
| |
| |
| |
The language Attribute | |
| |
| |
| |
XML Syntax for Directives | |
| |
| |
| |
Including Files and Applets in JSP Pages | |
| |
| |
| |
Including Pages at Request Time: The jsp:include Action | |
| |
| |
| |
Including Files at Page Translation Time: The include Directive | |
| |
| |
| |
Forwarding Requests with jsp:forward | |
| |
| |
| |
Including Applets for the Java Plug-In | |
| |
| |
| |
Using Javabeans Components in JSP Documents | |
| |
| |
| |
Why Use Beans? | |
| |
| |
| |
What Are Beans? | |
| |
| |
| |
Using Beans: Basic Tasks | |
| |
| |
| |
Example: StringBean | |
| |
| |
| |
Setting Bean Properties: Advanced Techniques | |
| |
| |
| |
Sharing Beans | |
| |
| |
| |
Sharing Beans in Four Different Ways: An Example | |
| |
| |
| |
Integrating Servlets and JSP: The Model View Controller (MVC) Architecture | |
| |
| |
| |
Understanding the Need for MVC | |
| |
| |
| |
Implementing MVC with RequestDispatcher | |
| |
| |
| |
Summarizing MVC Code | |
| |
| |
| |
Interpreting Relative URLs in the Destination Page | |
| |
| |
| |
Applying MVC: Bank Account Balances | |
| |
| |
| |
Comparing the Three Data-Sharing Approaches | |
| |
| |
| |
Forwarding Requests from JSP Pages | |
| |
| |
| |
Including Pages | |
| |
| |
| |
Simplifying Access to Java Code: The JSP 2.0 Expression Language | |
| |
| |
| |
Motivating EL Usage | |
| |
| |
| |
Invoking the Expression Language | |
| |
| |
| |
Preventing Expression Language Evaluation | |
| |
| |
| |
Preventing Use of Standard Scripting Elements | |
| |
| |
| |
Accessing Scoped Variables | |
| |
| |
| |
Accessing Bean Properties | |
| |
| |
| |
Accessing Collections | |
| |
| |
| |
Referencing Implicit Objects | |
| |
| |
| |
Using Expression Language Operators | |
| |
| |
| |
Evaluating Expressions Conditionally | |
| |
| |
| |
Previewing Other Expression Language Capabilities | |
| |
| |
| |
Supporting Technology | |
| |
| |
| |
Accessing Databases with JDBC | |
| |
| |
| |
Using JDBC in General | |
| |
| |
| |
Basic JDBC Examples | |
| |
| |
| |
Simplifying Database Access with JDBC Utilities | |
| |
| |
| |
Using Prepared Statements | |
| |
| |
| |
Creating Callable Statements | |
| |
| |
| |
Using Database Transactions | |
| |
| |
| |
Mapping Data to Objects by Using ORM Frameworks | |
| |
| |
| |
Configuring MS Access, MySQL, and Oracle91 | |
| |
| |
| |
Configuring Microsoft Access for Use with JDBC | |
| |
| |
| |
Installing and Configuring MySQL | |
| |
| |
| |
Installing and Configuring Oracle9i Database | |
| |
| |
| |
Testing Your Database Through a JDBC Connection | |
| |
| |
| |
Setting Up the music Table | |
| |
| |
| |
Creating and Processing HTML Forms | |
| |
| |
| |
How HTML Forms Transmit Data | |
| |
| |
| |
The FORM Element | |
| |
| |
| |
Text Controls | |
| |
| |
| |
Push Buttons | |
| |
| |
| |
Check Boxes and Radio Buttons | |
| |
| |
| |
Combo Boxes and List Boxes | |
| |
| |
| |
File Upload Controls | |
| |
| |
| |
Server-Side Image Maps | |
| |
| |
| |
Hidden Fields | |
| |
| |
| |
Groups of Controls | |
| |
| |
| |
Tab Order Control | |
| |
| |
| |
A Debugging Web Server | |
| |
| |
| |
Server Organization and Structure | |
| |
| |
Tomcat | |
| |
| |
Downloading the Software | |
| |
| |
Bookmarking the Servlet and JSP APIs | |
| |
| |
Configuring the Server | |
| |
| |
Setting Up Your Development Environment | |
| |
| |
Using the Default Web Application | |
| |
| |
Using Custom Web Applications | |
| |
| |
Viewing Autogenerated Code for JSP Pages | |
| |
| |
JRun | |
| |
| |
Downloading the Software | |
| |
| |
Bookmarking the Servlet and JSP APIs | |
| |
| |
Configuring the Server | |
| |
| |
Setting Up Your Development Environment | |
| |
| |
Using the Default Web Application | |
| |
| |
Using Custom Web Applications | |
| |
| |
Viewing Autogenerated Code for JSP Pages | |
| |
| |
Resin | |
| |
| |
Downloading the Software | |
| |
| |
Bookmarking the Servlet and JSP APIs | |
| |
| |
Configuring the Server | |
| |
| |
Setting Up Your Development Environment | |
| |
| |
Using the Default Web Application | |
| |
| |
Using Custom Web Applications | |
| |
| |
Viewing Autogenerated Code for JSP Pages | |
| |
| |
Index | |