table of contents
CSAJSP/1

 

Free Online Version of First Edition in PDF

Core Servlets and JavaServer Pages

Please note that the first edition is quite old now. The second edition is online here, and there are many even newer tutorials online here.

Chapter 1: Overview of Servlets and JavaServer Pages

View PDF of Overview of Servlets and JavaServer Pages chapter
View source code for Overview of Servlets and JavaServer Pages source code chapter

Topics:

  • What servlets are
  • When and why you would use servlets
  • What JavaServer Pages are
  • When and why you would use JSP
  • Obtaining the servlet and JSP software
  • Software installation and setup

Chapter 2: First Servlets

View PDF of First Servlets chapter
View source code for First Servlets source code chapter

Topics:

  • The basic structure of servlets
  • A simple servlet that generates plain text
  • The process of compiling, installing, and evoking servlets
  • A servlet that generates HTML
  • Some utilities to help build HTML
  • The life cycle of servlets
  • An example of reading initialization parameters
  • An example that uses initialization parameters and page modification dates
  • Servlet debugging strategies
  • A tool for interactively talking to servlets

Chapter 3: Handling the Client Request: Form Data

View PDF of Handling the Client Request: Form Data chapter
View source code for Handling the Client Request: Form Data source code chapter

Topics:

  • Using getParameter to read single values from prespecified parameters in the form data
  • Using getParameterValues to read multiple values from prespecified parameters in the form data
  • Using getParameterNames to discover what parameters are available
  • Handling both GET and POST requests with a single servlet
  • A servlet that makes a table of the input parameters
  • An on-line resume posting service
  • Filtering HTML-specific characters

Chapter 4: Handling the Client Request: HTTP Request Headers

View PDF of Handling the Client Request: HTTP Request Headers chapter
View source code for Handling the Client Request: HTTP Request Headers source code chapter

Topics:

  • Reading HTTP request headers
  • Building a table of all the request headers
  • The purpose of each of the HTTP 1.1 request headers
  • Reducing download times by compressing pages
  • Restricting access with password-protected servlets

Chapter 5: Accessing the Standard CGI Variables

View PDF of Accessing the Standard CGI Variables chapter
View source code for Accessing the Standard CGI Variables source code chapter

Topics:

  • The idea of "CGI variables"
  • The servlet equivalent of each standard CGI variable
  • A servlet that shows the values of all CGI variables

Chapter 6: Generating the Server Response: HTTP Status Codes

View PDF of Generating the Server Response: HTTP Status Codes chapter
View source code for Generating the Server Response: HTTP Status Codes source code chapter

Topics:

  • The purpose of HTTP status codes
  • The way to specify status codes from servlets
  • The meaning of each of the HTTP 1.1 status code values
  • A servlet that uses status codes to redirect users to other sites and to report errors

Chapter 7: Generating the Server Response: HTTP Response Headers

View PDF of Generating the Server Response: HTTP Response Headers chapter
View source code for Generating the Server Response: HTTP Response Headers source code chapter

Topics:

  • Setting response headers from servlets
  • The purpose of each of the HTTP 1.1 response headers
  • Common MIME types
  • A servlet that uses the Refresh header to repeatedly access ongoing computations
  • Servlets that expoit persistent (keep-alive) HTTP connections
  • Generating GIF images from servlets

Chapter 8: Handling Cookies

View PDF of Handling Cookies chapter
View source code for Handling Cookies source code chapter

Topics:

  • Purposes for cookies
  • Problems with cookies
  • The Cookie API
  • A simple servlet that sets cookies
  • A cookie-reporting servlet
  • Some utilities that simplify cookie handling
  • A customized search engine front end based upon cookies

Chapter 9: Session Tracking

View PDF of Session Tracking chapter
View source code for Session Tracking source code chapter

Topics:

  • The purpose of session tracking
  • The servlet session tracking API
  • A servlet that uses sessions to show per-client access counts
  • A reusable shopping cart class
  • An online store that uses session tracking, shopping carts, and pages automatically built from catalog entries

Chapter 10: JSP Scripting Elements

View PDF of JSP Scripting Elements chapter
View source code for JSP Scripting Elements source code chapter

Topics:

  • The purpose of JSP
  • How JSP pages are invoked
  • Using JSP expressions to inesrt dynamic results directly into the output page
  • Using JSP scriptlets to insert Java code into the method that handles requests for the page
  • Using JSP declarations to add methods and field declarations to the servlet that corresponds to the JSP page
  • Predefined variables that can be used within expressions and scriptlets

Chapter 11: The JSP page Directive: Structuring Generated Servlets

View PDF of The JSP page Directive: Structuring Generated Servlets chapter
View source code for The JSP page Directive: Structuring Generated Servlets source code chapter

Topics:

  • The purpose of the page directive
  • Designating which classes are imported
  • Using custom classes
  • Specifying the MIME types of the page
  • Generating Excel documents
  • Controlling threading behavior
  • Participating in sessions
  • Setting the size and behavior of the output buffer
  • Designating pages to process JSP errors
  • XML-compatible syntax for directives

Chapter 12: Including Files and Applets in JSP Documents

View PDF of Including Files and Applets in JSP Documents chapter
View source code for Including Files and Applets in JSP Documents source code chapter

Topics:

  • Including JSP files at the time the main page is translated into a servlet
  • Including HTML or plain text files at the time the client requests the page
  • Includiing applets that use the Java Plug-In

Chapter 13: Using JavaBeans with JSP

View PDF of Using JavaBeans with JSP chapter
View source code for Using JavaBeans with JSP source code chapter

Topics:

  • Creating and accessing beans
  • Installing bean classes on your server
  • Setting bean properties explicitly
  • Associating bean properties with input parameters
  • Automatic conversion of bean property types
  • Sharing beans among multiple JSP pages and servlets

Chapter 14: Creating Custom JSP Tag Libraries

View PDF of Creating Custom JSP Tag Libraries chapter
View source code for Creating Custom JSP Tag Libraries source code chapter

Topics:

  • Tag handler classes
  • Tag library descriptor files
  • The JSP taglib directive
  • Simple tags
  • Tags that use attributes
  • Tags that use the nody content between their start and end tags
  • Tags that modify their body content
  • Looping tags
  • Nested tags

Chapter 15: Integrating Servlets and JSP

View PDF of Integrating Servlets and JSP chapter
View source code for Integrating Servlets and JSP source code chapter

Topics:

  • Obtaining a RequestDispatcher
  • Forwarding requests from servlets to dynamic resources
  • Forwarding requests from servlets to static resources
  • Using servlets to set up beans for use by JSP pages
  • An on-line travel agency combining servlets and JSP
  • Including JSP output in servlets
  • A servlet that shows the raw HTML output of JSP pages
  • Using jsp:forward to forward requests from JSP pages

Chapter 16: Using HTML Forms

View PDF of Using HTML Forms chapter
View source code for Using HTML Forms source code chapter

Topics:

  • Sending data from forms
  • Text controls
  • Push buttons
  • Check boxes and radio buttons
  • Combo boxes and list boxes
  • File upload controls
  • Server-side image maps
  • Hidden fields
  • Gouping controls
  • Tab ordering
  • A Web server for debuging forms

Chapter 17: Using Applets As Servlet Front Ends

View PDF of Using Applets As Servlet Front Ends chapter
View source code for Using Applets As Servlet Front Ends source code chapter

Topics:

  • Sending GET data and having the browser display the results
  • Sending GET data and processing the results within the applet (HTTP tunneling)
  • Using object serialization to exchange high-level data structures between applets and servlets
  • Sending POST data and processing the results within the applet
  • Bypassing the HTTP server altogether

Chapter 18: JDBC and Database Connection Pooling

View PDF of JDBC and Database Connection Pooling chapter
View source code for JDBC and Database Connection Pooling source code chapter

Topics:

  • The seven basic steps to connecting to databases
  • Simple database retrieval example
  • Some utilities that simplify JDBC usage
  • Formatting a database result as plain text or HTML
  • An interactive graphical querry viewer
  • Precompiled querries
  • A connection pool library
  • A comparison of servlet performance with and without connection pooling
  • Sharing connection pools

Appendix


More Information

Java

JSF (JavaServer Faces)

Servlets & JSP
Ajax, GWT, & JavaScript

Spring, Hibernate, & JPA

Struts