Core Servlets and JavaServer Pages™

Book description

  • Practical guide to using Java for Web-enabled applications and dynamic Web sites

  • In-depth coverage of the latest J2EE standards: servlets version 2.2 and JSP 1.1

  • Hundreds of completely portable, fully documented, industrial-strength examples

  • Configuration details for Apache Tomcat, Sun's JSWDK, and the Java Web Server

  • Servlets and JavaServer Pages provide a powerful, efficient, portable, and secure alternative to CGI programming for developing professional e-commerce sites and other Web-enabled applications. Here's all you need to leverage the latest J2EE servlet 2.2 and JSP 1.1 standards: real-world insight, advanced techniques, industrial-strength code, and hands-on coverage of three top servlet/JSP engines, including Apache Tomcat.

  • Part I gives exhaustive coverage of servlets 2.1 and 2.2. Starts with basic syntax, the servlet life cycle, and use of form data. Moves on to leveraging HTTP 1.1, cookies, and session tracking. Advanced topics include compressed Web content, persistent connections, dynamically generated images, and shopping carts for e-commerce.

  • Part II provides an in-depth guide to JSP 1.0 and 1.1, including advice on when to use servlets, JSP, or a combination of the two. Discusses every standard JSP element, including approaches for integrating JavaBeans. Advanced techniques include sharing beans, generating Excel spreadsheets, and defining custom JSP tag libraries.

  • Part III covers key supporting technologies: HTML forms, JDBC and database connection pooling, and the use of applets to communicate with servlets.

  • Servlet and JSP Quick Reference provides a handy syntax and usage summary.

  • Every Core Series book:

  • Demonstrates practical techniques used by professional developers

  • Features robust, thoroughly tested sample code and realistic examples

  • Focuses on the cutting-edge technologies you need to master today

  • Provides expert advice that will help you build superior software

  • Core Servlets and JavaServer Pages delivers:

  • Practical techniques for streamlining Web-enabled application development

  • Proven strategies for optimizing servlet and JSP performance

  • In-depth, hands-on coverage of the latest standards: servlets 2.2 and JSP 1.1

  • On-line access to all source code, available free for unrestricted use

  • Table of contents

    1. Copyright
    2. Acknowledgements
    3. Introduction
    4. SERVLETS 2.1 AND 2.2
      1. OVERVIEW OF SERVLETS AND JAVASERVER PAGES
        1. Servlets
        2. The Advantages of Servlets Over “Traditional” CGI
        3. JavaServer Pages
        4. The Advantages of JSP
        5. Installation and Setup
      2. FIRST SERVLETS
        1. Basic Servlet Structure
        2. A Simple Servlet Generating Plain Text
        3. A Servlet That Generates HTML
        4. Packaging Servlets
        5. Simple HTML-Building Utilities
        6. The Servlet Life Cycle
        7. An Example Using Initialization Parameters
        8. An Example Using Servlet Initialization and Page Modification Dates
        9. Debugging Servlets
        10. WebClient: Talking to Web Servers Interactively
      3. HANDLING THE CLIENT REQUEST: FORM DATA
        1. The Role of Form Data
        2. Reading Form Data from Servlets
        3. Example: Reading Three Explicit Parameters
        4. Example: Reading All Parameters
        5. A Resumé Posting Service
        6. Filtering Strings for HTML-Specific Characters
      4. HANDLING THE CLIENT REQUEST: HTTP REQUEST HEADERS
        1. Reading Request Headers from Servlets
        2. Printing All Headers
        3. HTTP 1.1 Request Headers
        4. Sending Compressed Web Pages
        5. Restricting Access to Web Pages
      5. ACCESSING THE STANDARD CGI VARIABLES
        1. Servlet Equivalent of CGI Variables
        2. A Servlet That Shows the CGI Variables
      6. GENERATING THE SERVER RESPONSE: HTTP STATUS CODES
        1. Specifying Status Codes
        2. HTTP 1.1 Status Codes and Their Purpose
        3. A Front End to Various Search Engines
      7. GENERATING THE SERVER RESPONSE: HTTP RESPONSE HEADERS
        1. Setting Response Headers from Servlets
        2. HTTP 1.1 Response Headers and Their Meaning
        3. Persistent Servlet State and Auto-Reloading Pages
        4. Using Persistent HTTP Connections
        5. Using Servlets to Generate GIF Images
      8. HANDLING COOKIES
        1. Benefits of Cookies
        2. Some Problems with Cookies
        3. The Servlet Cookie API
        4. Examples of Setting and Reading Cookies
        5. Basic Cookie Utilities
        6. A Customized Search Engine Interface
      9. SESSION TRACKING
        1. The Need for Session Tracking
        2. The Session Tracking API
        3. A Servlet Showing Per-Client Access Counts
        4. An On-Line Store Using a Shopping Cart and Session Tracking
    5. JAVASERVER PAGES
      1. JSP SCRIPTING ELEMENTS
        1. Scripting Elements
        2. JSP Expressions
        3. JSP Scriptlets
        4. JSP Declarations
        5. Predefined Variables
      2. THE JSP PAGE DIRECTIVE: STRUCTURING GENERATED SERVLETS
        1. The import Attribute
        2. The contentType Attribute
        3. The isThreadSafe Attribute
        4. The session Attribute
        5. The buffer Attribute
        6. The autoflush Attribute
        7. The extends Attribute
        8. The info Attribute
        9. The errorPage Attribute
        10. The isErrorPage Attribute
        11. The language Attribute
        12. XML Syntax for Directives
      3. INCLUDING FILES AND APPLETS IN JSP DOCUMENTS
        1. Including Files at Page Translation Time
        2. Including Files at Request Time
        3. Including Applets for the Java Plug-In
      4. USING JAVABEANS WITH JSP
        1. Basic Bean Use
        2. Example: StringBean
        3. Setting Bean Properties
        4. Sharing Beans
      5. CREATING CUSTOM JSP TAG LIBRARIES
        1. The Components That Make Up a Tag Library
        2. Defining a Basic Tag
        3. Assigning Attributes to Tags
        4. Including the Tag Body
        5. Optionally Including the Tag Body
        6. Manipulating the Tag Body
        7. Including or Manipulating the Tag Body Multiple Times
        8. Using Nested Tags
      6. INTEGRATING SERVLETS AND JSP
        1. Forwarding Requests
        2. Example: An On-Line Travel Agent
        3. Including Static or Dynamic Content
        4. Example: Showing Raw Servlet and JSP Output
        5. Forwarding Requests From JSP Pages
    6. SUPPORTING TECHNOLOGIES
      1. USING HTML FORMS
        1. How HTML Forms Transmit Data
        2. The FORM Element
        3. Text Controls
        4. Push Buttons
        5. Check Boxes and Radio Buttons
        6. Combo Boxes and List Boxes
        7. File Upload Controls
        8. Server-Side Image Maps
        9. Hidden Fields
        10. Grouping Controls
        11. Controlling Tab Order
        12. A Debugging Web Server
      2. USING APPLETS AS SERVLET FRONT ENDS
        1. Sending Data with GET and Displaying the Resultant Page
        2. A Multisystem Search Engine Front End
        3. Sending Data with GET and Processing the Results Directly (HTTP Tunneling)
        4. A Query Viewer That Uses Object Serialization and HTTP Tunneling
        5. Sending Data by POST and Processing the Results Directly (HTTP Tunneling)
        6. An Applet That Sends POST Data
        7. Bypassing the HTTP Server
      3. JDBC AND DATABASE CONNECTION POOLING
        1. Basic Steps in Using JDBC
        2. Basic JDBC Example
        3. Some JDBC Utilities
        4. Applying the Database Utilities
        5. An Interactive Query Viewer
        6. Prepared Statements (Precompiled Queries)
        7. Connection Pooling
        8. Connection Pooling: A Case Study
        9. Sharing Connection Pools
      4. SERVLET AND JSP QUICK REFERENCE
        1. Overview of Servlets and JavaServer Pages
        2. First Servlets
        3. Handling the Client Request: Form Data
        4. Handling the Client Request: HTTP Request Headers
        5. Accessing the Standard CGI Variables
        6. Generating the Server Response: HTTP Status Codes
        7. Generating the Server Response: HTTP Response Headers
        8. Handling Cookies
        9. Session Tracking
        10. JSP Scripting Elements
        11. The JSP page Directive: Structuring Generated Servlets
        12. Including Files and Applets in JSP Documents
        13. Using JavaBeans with JSP
        14. Creating Custom JSP Tag Libraries
        15. Integrating Servlets and JSP
        16. Using HTML Forms
        17. Using Applets As Servlet Front Ends
        18. JDBC and Database Connection Pooling

    Product information

    • Title: Core Servlets and JavaServer Pages™
    • Author(s): Marty Hall
    • Release date: May 2000
    • Publisher(s): Pearson
    • ISBN: 9780130893406