You are previewing More Servlets and JavaServer Pages™.
O'Reilly logo
More Servlets and JavaServer Pages™

Book Description

  • Companion to the worldwide bestseller Core Servlets and JavaServer Pages

  • Practical guide to the use of the Java Platform for Web-enabled applications and dynamic Web sites

  • Focus on new capabilities: the servlet 2.3 and JSP 1.2 specifications, the standard JSP tag library (JSPTL), filters, life-cycle event listeners, security, Web applications, and much more

  • Configuration and usage details for Apache Tomcat, Macromedia JRun, and New Atlanta ServletExec

  • The Java 2 Platform has become the technology of choice for developing professional e-commerce applications, dynamic Web pages, and Web-enabled applications and services. Servlet and JSP technology is the foundation of this platform: it provides the link between Web clients and server-side applications. But, the field has been evolving rapidly, and few developers have been able to keep up. In this companion to Core Servlets and JavaServer Pages, Marty Hall shows you how to apply recent advances in servlet and JSP technology. The book provides everything you need to know to leverage the latest servlet 2.3 and JSP 1.2 standards: real-world insight, advanced techniques, industrial-strength code, and hands on coverage of three top servers: Apache Tomcat, Macromedia JRun, and New Atlanta ServletExec.

  • Part I gives a thorough introduction to programming with servlet and JSP technology. It shows you how to configure your server, read form data and HTTP headers, handle cookies, track sessions, apply JSP scripting elements, use JavaBeans components, develop JSP tag libraries, and apply the MVC architecture.

  • Part II provides exhaustive details on Web application development and deployment. It explains how to register Web applications, how to organize them, how to deploy them in WAR files, how to deal with relative URLs, and how to share data among Web applications. It also gives details on every element in version 2.3 of the deployment descriptor (web.xml).

  • Part III describes Web application security in detail. It explains two general strategies for securing your applications: declarative security and programmatic security. Within each of these strategies, it shows you how to use form-based or BASIC authentication and how to protect your network traffic with SSL.

  • Part IV covers two features introduced with servlets 2.3: filters and life-cycle events. It explains how to use filters to debug, modify, and optimize the output of previously existing servlets and JSP pages. It also shows you how to use event listeners to respond to major events in the server life cycle.

  • Part V looks at new tag library developments. It shows you how to improve your own tag libraries by making use of new capabilities of the JSP 1.2 specification and explains how to streamline your code by using the new standard JSP tag library (JSPTL).

  • More Servlets and JavaServer Pages delivers:

  • The same clear, step-by-step explanations that make Marty's books so popular

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

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

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

  • Table of Contents

    1. Copyright
    2. Acknowledgments
    3. Introduction
    4. The Basics
      1. Server Setup and Configuration
        1. Download the Java Development Kit (JDK)
        2. Download a Server for Your Desktop
        3. Change the Port and Configure Other Server Settings
        4. Test the Server
        5. Try Some Simple HTML and JSP Pages
        6. Set Up Your Development Environment
        7. Compile and Test Some Simple Servlets
        8. Establish a Simplified Deployment Method
        9. Deployment Directories for Default Web Application: Summary
      2. A Fast Introduction to Basic Servlet Programming
        1. The Advantages of Servlets Over “Traditional” CGI
        2. Basic Servlet Structure
        3. The Servlet Life Cycle
        4. The Client Request: Form Data
        5. The Client Request: HTTP Request Headers
        6. The Servlet Equivalent of the Standard CGI Variables
        7. The Server Response: HTTP Status Codes
        8. The Server Response: HTTP Response Headers
        9. Cookies
        10. Session Tracking
      3. A Fast Introduction to Basic JSP Programming
        1. JSP Overview
        2. Advantages of JSP
        3. Invoking Code with JSP Scripting Elements
        4. Structuring Autogenerated Servlets: The JSP page Directive
        5. Including Files and Applets in JSP Documents
        6. Using JavaBeans with JSP
        7. Defining Custom JSP Tag Libraries
        8. Integrating Servlets and JSP: The MVC Architecture
    5. Web Applications
      1. Using and Deploying Web Applications
        1. Registering Web Applications
        2. Structure of a Web Application
        3. Deploying Web Applications in WAR Files
        4. Recording Dependencies on Server Libraries
        5. Handling Relative URLs in Web Applications
        6. Sharing Data Among Web Applications
      2. Controlling Web Application Behavior with web.xml
        1. Defining the Header and Root Elements
        2. The Order of Elements within the Deployment Descriptor
        3. Assigning Names and Custom URLs
        4. Disabling the Invoker Servlet
        5. Initializing and Preloading Servlets and JSP Pages
        6. Declaring Filters
        7. Specifying Welcome Pages
        8. Designating Pages to Handle Errors
        9. Providing Security
        10. Controlling Session Timeouts
        11. Documenting Web Applications
        12. Associating Files with MIME Types
        13. Locating Tag Library Descriptors
        14. Designating Application Event Listeners
        15. J2EE Elements
      3. A Sample Web Application: An Online Boat Shop
        1. General Configuration Files
        2. The Top-Level Page
        3. The Second-Level Pages
        4. The Item Display Servlet
        5. The Purchase Display Page
    6. Web Application Security
      1. Declarative Security
        1. Form-Based Authentication
        2. Example: Form-Based Authentication
        3. BASIC Authentication
        4. Example: BASIC Authentication
        5. Configuring Tomcat to Use SSL
      2. Programmatic Security
        1. Combining Container-Managed and Programmatic Security
        2. Example: Combining Container-Managed and Programmatic Security
        3. Handling All Security Programmatically
        4. Example: Handling All Security Programmatically
        5. Using Programmatic Security with SSL
        6. Example: Programmatic Security and SSL
    7. Major New Servlet and JSP Capabilities
      1. Servlet and JSP Filters
        1. Creating Basic Filters
        2. Example: A Reporting Filter
        3. Accessing the Servlet Context from Filters
        4. Example: A Logging Filter
        5. Using Filter Initialization Parameters
        6. Example: An Access Time Filter
        7. Blocking the Response
        8. Example: A Prohibited-Site Filter
        9. Modifying the Response
        10. Example: A Replacement Filter
        11. Example: A Compression Filter
        12. The Complete Filter Deployment Descriptor
      2. The Application Events Framework
        1. Monitoring Creation and Destruction of the Servlet Context
        2. Example: Initializing Commonly Used Data
        3. Detecting Changes in Servlet Context Attributes
        4. Example: Monitoring Changes to Commonly Used Data
        5. Packaging Listeners with Tag Libraries
        6. Example: Packaging the Company Name Listeners
        7. Recognizing Session Creation and Destruction
        8. Example: A Listener That Counts Sessions
        9. Watching for Changes in Session Attributes
        10. Example: Monitoring Yacht Orders
        11. Using Multiple Cooperating Listeners
        12. The Complete Events Deployment Descriptor
    8. New Tag Library Capabilities
      1. New Tag Library Features in JSP 1.2
        1. Using the New Tag Library Descriptor Format
        2. Bundling Listeners with Tag Libraries
        3. Checking Syntax with TagLibraryValidator
        4. Aside: Parsing XML with SAX 2.0
        5. Handling Exceptions with the TryCatchFinally Interface
        6. New Names for Return Values
        7. Looping Without Generating BodyContent
        8. Introducing Scripting Variables in the TLD File
      2. The JSP Standard Tag Library
        1. Using JSTL: An Overview
        2. Installing and Configuring JSTL
        3. Looping with the forEach Tag
        4. Accessing the Loop Status
        5. Looping with the forTokens Tag
        6. Evaluating Items Conditionally
        7. Using the Expression Language
    9. Server Organization and Structure
      1. Download Sites
      2. Starting and Stopping the Server
      3. Servlet JAR File Locations
      4. Locations for Files in the Default Web Application
      5. Locations for Files in Custom Web Applications