You are previewing Java Servlet & JSP Cookbook.
O'Reilly logo
Java Servlet & JSP Cookbook

Book Description

With literally hundreds of examples and thousands of lines of code, the Java Servlet and JSP Cookbook yields tips and techniques that any Java web developer who uses JavaServer Pages or servlets will use every day, along with full-fledged solutions to significant web application development problems that developers can insert directly into their own applications. Java Servlet and JSP Cookbook presents real-world problems, and provides concise, practical solutions to each. Finding even one tested code "recipe" that solves a gnarly problem in this comprehensive collection of solutions and best practices will save hours of frustration--easily justifying the cost of this invaluable book. But "Java Servlet and JSP Cookbook" is more than just a wealth of cut-and-paste code. It also offers clear explanations of how and why the code works, warns of potential pitfalls, and directs you to sources of additional information, so you can learn to adapt the problem-solving techniques to similar situations. These recipes include vital topics like the use of Ant to setup a build environment, extensive coverage of the WAR file format and web.xml deployment descriptor, file-uploading, error-handling, cookies, logging, dealing with non-HTML content, multimedia, request filtering, web services, I18N, web services, and a host of other topics that frustrate even the most seasoned developers. For Java web developers of all levels who are eager to put into practice the theory presented in other API-focused books, the solutions presented in this practical book will prove invaluable over and over again. This is painless way for less experienced developers who prefer to learn by doing to expand their skills and productivity, while accomplishing practical solutions to the pressing problems they face every day. More experienced developers can use these recipes to solve time-consuming problems quickly, freeing up their time for the more creative aspects of their work.

Table of Contents

  1. Java Servlet & JSP Cookbook
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. A Note Regarding Supplemental Files
    3. Preface
      1. What's in the Book
        1. BEA WebLogic Recipes
      2. Audience
        1. What You Need to Know
      3. Organization
      4. Conventions Used in This Book
      5. Using Code Examples
      6. Comments and Questions
      7. Acknowledgments
    4. 1. Writing Servlets and JSPs
      1. Introduction
      2. 1.1. Writing a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 1.2. Writing a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 1.3. Compiling a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 1.4. Packaging Servlets and JSPs
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 1.5. Creating the Deployment Descriptor
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    5. 2. Deploying Servlets and JSPs
      1. Introduction
      2. 2.1. Deploying an Individual Servlet on Tomcat
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 2.2. Using a Context Element in Tomcat'sserver.xml
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 2.3. Deploying an Individual Servlet on WebLogic
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 2.4. Deploying an Individual JSP on Tomcat
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 2.5. Deploying an Individual JSP on WebLogic
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 2.6. Deploying a Web Application on Tomcat
        1. Problem
        2. Solution
        3. Discussion
          1. Using Ant for deployment
        4. See Also
      8. 2.7. Deploying a Web Application on WebLogic Using Ant
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 2.8. Using the WebLogic Administration Console
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      10. 2.9. Using WebLogic Builder to Deploy a Web Application
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      11. 2.10. Using the weblogic.DeployerCommand-Line Tool
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    6. 3. Naming Your Servlets
      1. Introduction
      2. 3.1. Mapping a Servlet to a Name in web.xml
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 3.2. Creating More Than One Mapping to a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 3.3. Creating a JSP-Type URL for a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 3.4. Mapping Static Content to a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 3.5. Invoking a Servlet Without a web.xml Mapping
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 3.6. Mapping All Requests Within a Web Application to a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 3.7. Mapping Requests to a Controller and Preserving Servlet Mappings
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 3.8. Creating Welcome Files for a Web Application
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      10. 3.9. Restricting Requests for Certain Servlets
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      11. 3.10. Giving Only the Controller Access to Certain Servlets
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    7. 4. Using Apache Ant
      1. Introduction
      2. 4.1. Obtaining and Setting Up Ant
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 4.2. Using Ant Targets
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 4.3. Including Tomcat JAR files in the Build File Classpath
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 4.4. Compiling a Servlet with an Ant Build File
        1. Problem
        2. Solution
        3. Discussion
          1. Using the command line to declare the target servlet
        4. See Also
      6. 4.5. Creating a WAR File with Ant
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 4.6. Creating a JAR File with Ant
        1. Problem
        2. Solution
        3. Discussion
          1. Manifest
        4. See Also
      8. 4.7. Starting a Tomcat Application with Ant
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 4.8. Stopping a Tomcat Application with Ant
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    8. 5. Altering the Format of JSPs
      1. Introduction
        1. Precompiling JSPs
        2. JSPs as XML Documents
      2. 5.1. Precompiling a JSP in Tomcat
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 5.2. Precompiling a JSP in WebLogic
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 5.3. Precompiling JSPs with the Precompilation Protocol
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 5.4. Mapping a JSP to Its Page Implementation Class
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 5.5. Creating a JSP from Scratch as a JSP Document
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 5.6. Generating an XML View from a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    9. 6. Dynamically Including Content in Servlets and JSPs
      1. Introduction
      2. 6.1. Including a Resource Each Time a Servlet Handles a Request
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 6.2. Using an External Configuration to Include a Resource in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 6.3. Including Resources Nested at Multiple Levels in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 6.4. Including a Resource that Seldom Changes into a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 6.5. Including Content in a JSP Each Time the JSP Handles a Request
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 6.6. Using an External Configuration File to Include a Resource in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 6.7. Including an XML Fragment in a JSP Document
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 6.8. Including Content from Outside a Context in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    10. 7. Handling Web Form Data in Servlets and JSPs
      1. Introduction
      2. 7.1. Handling a POST HTTP Request in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 7.2. Handling a POST HTTP Request in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 7.3. Setting the Properties of a JavaBean in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 7.4. Setting a Scoped Attribute in a JSP to the Value of a Form Parameter
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 7.5. Posting Data from a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 7.6. Posting Data from a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 7.7. Using a Servlet to Add a Parameter to a Query String
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 7.8. Using a JSP to Add a Parameter to a Query String
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      10. 7.9. Using a Filter to Read Parameter Values
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    11. 8. Uploading Files
      1. Introduction
      2. 8.1. Preparing the HTML Page for File Uploads
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 8.2. Using the com.oreilly.servlet Library
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 8.3. Uploading One File at a Time
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 8.4. Uploading Multiple Files
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 8.5. Renaming Files
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 8.6. Using a JSP to Handle a File Upload
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    12. 9. Handling Exceptions in Web Applications
      1. Introduction
      2. 9.1. Declaring Exception Handlers in web.xml
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 9.2. Creating an Exception-Handling Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 9.3. Sending an Error from a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 9.4. Sending an Error from a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 9.5. Creating an Error-Handling JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 9.6. Declaring a Special Exception-Handling JSP for Other JSPs
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    13. 10. Reading and Setting Cookies
      1. Introduction
      2. 10.1. Setting a Cookie with a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 10.2. Creating an Array from All of the Request's Cookies
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 10.3. Setting a Cookie with a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 10.4. Reading Cookie Values with a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 10.5. Reading Cookie Values with a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 10.6. Altering or Removing a Cookie That Has Already Been Set
        1. Problem
        2. Solution
        3. Discussion
          1. Deleting a Cookie
        4. See Also
    14. 11. Session Tracking
      1. Introduction
        1. Disabled Cookies
      2. 11.1. Setting the Session Timeout in web.xml
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 11.2. Setting the Session Timeout in All Tomcat Web Applications
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 11.3. Setting the Session Timeout Programmatically
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 11.4. Checking if a Session Exists in an HttpServletRequest
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 11.5. Tracking Session Activity in Servlets
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 11.6. Tracking Session Activity in JSPs
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 11.7. Using URL Rewriting in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 11.8. Using URL Rewriting in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      10. 11.9. Using a Listener to Track the Session Lifecycle
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      11. 11.10. Using a Listener to Monitor Session Attributes
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      12. 11.11. Using a Filter to Monitor Session Attributes
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    15. 12. Integrating JavaScript with Servlets and JSPs
      1. Introduction
      2. 12.1. Including JavaScript Modules in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 12.2. Including JavaScript Modules in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 12.3. Creating a New Window with JavaScript in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 12.4. Creating a New Window with JavaScript in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 12.5. Using JavaScript to Validate Form Values in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 12.6. Using JavaScript to Validate Form Values in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    16. 13. Sending Non-HTML Content
      1. Introduction
      2. 13.1. Sending a PDF File
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 13.2. Sending a Word Processing File
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 13.3. Sending an XML file
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 13.4. Sending an Audio File
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 13.5. Viewing Internal Resources in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    17. 14. Logging Messages from Servlets and JSPs
      1. Introduction
        1. Loggers
        2. Appenders
        3. Layouts
      2. 14.1. Logging Without Log4j
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 14.2. Setting Up Log4j
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 14.3. Using a Logger Without a Configuration File
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 14.4. Adding an Appender to the Root Logger
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 14.5. Using a Pattern with a Logger's Appender
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 14.6. Using log4j in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 14.7. Logging Messages Using a Servlet Context Event Listener
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 14.8. Logging Messages Using a Session Event Listener
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    18. 15. Authenticating Clients
      1. Introduction
      2. 15.1. Creating Users and Passwords with Tomcat
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 15.2. Setting Up SSL on Tomcat
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 15.3. Using BASIC Authentication
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 15.4. Using Form-Based Authentication
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 15.5. Logging Out a User
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 15.6. Using JAAS to Create a LoginModule
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 15.7. Creating the JAAS Configuration File
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 15.8. Using JAAS in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      10. 15.9. Using JAAS in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    19. 16. Binding, Accessing, and Removing Attributes in Web Applications
      1. Introduction
      2. 16.1. Setting ServletContext Attributes in Servlets
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 16.2. Setting ServletContext Attributes in JSPs
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 16.3. Accessing or Removing ServletContext Attributes in Servlets
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 16.4. Accessing or Removing ServletContext Attributes in JSPs
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 16.5. Setting Session Attributes in Servlets
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 16.6. Setting Session Attributes in JSPs
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 16.7. Accessing or Removing Session Attributes in Servlets
        1. Problem
        2. Solution
        3. Discussion
          1. Removing the session attribute from a servlet
        4. See Also
      9. 16.8. Accessing or Removing Session Attributes in JSPs
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      10. 16.9. Setting Request Attributes in Servlets
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      11. 16.10. Setting Request Attributes in JSPs
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      12. 16.11. Accessing or Removing Request Attributes in Servlets
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      13. 16.12. Accessing or Removing Request Attributes in JSPs
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    20. 17. Embedding Multimedia in JSPs
      1. Introduction
      2. 17.1. Embedding an Applet in a JSPUsing jsp:plugin
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 17.2. Embedding an Applet in a JSP Using the HTML Converter
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 17.3. Automatically Creating HTML Template for Including Flash Files
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 17.4. Writing HTML Template to Embed a Flash File
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 17.5. Embedding Flash in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 17.6. Embedding a QuickTime Movie in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 17.7. Embedding an SVG File in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 17.8. Embedding a Background Soundtrack in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    21. 18. Working With the Client Request
      1. Introduction
      2. 18.1. Examining HTTP Request Headers in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 18.2. Examining HTTP Request Headers in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 18.3. Using a Filter to Alter Request Headers
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 18.4. Automatically Refreshing a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 18.5. Automatically Refreshing a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 18.6. Counting the Number of Web Application Requests
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    22. 19. Filtering Requests and Responses
      1. Introduction
      2. 19.1. Mapping a Filter to a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 19.2. Mapping a Filter to a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 19.3. Mapping More Than One Filter to a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 19.4. Changing the Order in Which Filters are Applied to Servlets
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 19.5. Configuring Initialization Parameters for a Filter
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 19.6. Optionally Blocking a Request with a Filter
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 19.7. Filtering the HTTP Response
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 19.8. Using Filters with RequestDispatcher Objects
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      10. 19.9. Checking Form Parameters with a Filter
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      11. 19.10. Blocking IP Addresses with a Filter
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    23. 20. Managing Email in Servlets and JSPs
      1. Introduction
      2. 20.1. Placing the Email-Related Classes on your Classpath
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 20.2. Sending Email from a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 20.3. Sending Email from a Servlet Using a JavaBean
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 20.4. Accessing Email from a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 20.5. Accessing Email from a Servlet Using a JavaBean
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 20.6. Handling Attachments from an Email Received in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 20.7. Adding Attachments to an Email in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 20.8. Reading a Received Email's Headers from a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    24. 21. Accessing Databases
      1. Introduction
      2. 21.1. Accessing a Database from a Servlet Without DataSource
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 21.2. Configuring a DataSource in Tomcat
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 21.3. Using a DataSource in a Servlet with Tomcat
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 21.4. Creating a DataSource on WebLogic
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 21.5. Using a JNDI Lookup to get a DataSource from WebLogic
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 21.6. Using a DataSource from WebLogic in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 21.7. Calling a Stored Procedure from a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 21.8. Calling a Stored Procedure from a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      10. 21.9. Converting a ResultSet to a Result Object
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      11. 21.10. Executing Several SQL Statements Within a Single Transaction
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      12. 21.11. Using Transactions with JSPs
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      13. 21.12. Finding Information about a ResultSet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    25. 22. Using Custom Tag Libraries
      1. Introduction
      2. 22.1. Creating a Classic Tag Handler
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 22.2. Creating a JSP 1.2 TLD for a Classic Tag Handler
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 22.3. Creating a JSP 2.0 TLD for a Classic Tag Handler
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 22.4. Packaging a Tag Library in a Web Application
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 22.5. Packaging the Tag Library in a JAR File
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 22.6. Using the Custom Tag in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 22.7. Handling Exceptions in a Custom Tag Class
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 22.8. Creating a Simple Tag Handler
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      10. 22.9. Creating a TLD for a Simple Tag Handler
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      11. 22.10. Using a Simple Tag Handler in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      12. 22.11. Creating a JSP Tag File
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      13. 22.12. Packaging the JSP Tag File in a Web Application
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      14. 22.13. Packaging the JSP Tag File in a JAR
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      15. 22.14. Using a Custom Tag Associated with a Tag File
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      16. 22.15. Adding a Listener Class to a Tag Library
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    26. 23. Using the JSTL
      1. Introduction
      2. 23.1. Downloading the JSTL 1.0 and Using the JSTL Tags in JSPs
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 23.2. Downloading the Java Web Services Developer Pack
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 23.3. Using the Core JSTL Tags
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 23.4. Using the XML Core JSTL Tags
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 23.5. Using the XML Transform Tags
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 23.6. Using the Formatting JSTL Tags
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 23.7. Using A SQL JSTL Tag with a DataSource Configuration
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 23.8. Using A SQL JSTL Tag Without a DataSource Configuration
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      10. 23.9. Accessing Scoped Variables with the EL
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      11. 23.10. Accessing Request Parameters with the EL
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      12. 23.11. Using the EL to Access Request Headers
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      13. 23.12. Using the EL to Access One Request Header
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      14. 23.13. Accessing Cookies with the EL
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      15. 23.14. Using the EL to Access JavaBean Properties
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      16. 23.15. Using JSTL Functions
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    27. 24. Internationalization
      1. Introduction
      2. 24.1. Detecting the Client Locale in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 24.2. Detecting the Client's Locales in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 24.3. Creating a ResourceBundle as a Properties File
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 24.4. Creating a ResourceBundle as a Java Class
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 24.5. Using the ResourceBundle in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 24.6. Using the ResourceBundle in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 24.7. Formatting Dates in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 24.8. Formatting Dates in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      10. 24.9. Formatting Currencies in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      11. 24.10. Formatting Currencies in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      12. 24.11. Formatting Percentages in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      13. 24.12. Formatting Percentages in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      14. 24.13. Setting the Localization Context in the Deployment Descriptor
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    28. 25. Using JNDI and Enterprise JavaBeans
      1. Introduction
      2. 25.1. Configuring a JNDI Object in Tomcat
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 25.2. Accessing the Tomcat JNDI Resource from a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 25.3. Accessing the Tomcat JNDI Resource from a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 25.4. Configuring a JNDI Resource in WebLogic
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 25.5. Viewing the JNDI Tree in WebLogic
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      7. 25.6. Accessing the WebLogic JNDI Resource from a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 25.7. Accessing the WebLogic JNDI Resource from a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 25.8. Accessing an EJB Using the WebLogic JNDI Tree
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    29. 26. Harvesting Web Information
      1. Introduction
      2. 26.1. Parsing an HTML Page Using thejavax.swing.text Subpackages
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 26.2. Using a Servlet to Harvest Web Data
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 26.3. Creating a JavaBean as a Web Page Parser
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 26.4. Using the Web Page Parsing JavaBean in a Servlet
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 26.5. Using the Web Page Parsing JavaBean in a JSP
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    30. 27. Using the Google and Amazon Web APIs
      1. Introduction
      2. 27.1. Getting Set Up with Google's Web API
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      3. 27.2. Creating a JavaBean to Connect with Google
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      4. 27.3. Using a Servlet to Connect with Google
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      5. 27.4. Using a JSP to Connect with Google
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      6. 27.5. Getting Set Up with Amazon's Web Services API
        1. Problem
        2. Solution
        3. Discussion
          1. SOAP with Apache Axis
        4. See Also
      7. 27.6. Creating a JavaBean to Connect with Amazon
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      8. 27.7. Using a Servlet to Connect with Amazon
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
      9. 27.8. Using a JSP to Connect with Amazon
        1. Problem
        2. Solution
        3. Discussion
        4. See Also
    31. Colophon
    32. SPECIAL OFFER: Upgrade this ebook with O’Reilly