Free Online Version of Second Edition
Core Servlets and JavaServer Pages
by Marty Hall and Larry Brown
The second edition of Core Servlets and
JavaServer Pages is now available for free access in PDF. See links below.
Readers of the older edition can still access
the first edition here .
There is now a free online servlet and JSP tutorial based on the book. The tutorial has complete source code that has been updated to the latest
servlet and JSP versions, uses Eclipse, and has exercises and exercise solutions.
See http://courses.coreservlets.com/Course-Materials/csajsp2.html .
Also, many (most?) new Web apps should consider using JSF 2 as a higher-level alternative to servlets and JSP.
See the JSF 2 tutorial series .
If you find these free tutorials helpful, we would appreciate it if you would
link to us .
Topics in Chapter:
Understanding the role of servlets
Building Web pages dynamically
Looking at servlet code
Evaluating servlets vs. other technologies
Understanding the role of JSP
Topics in Chapter:
Installing and configuring Java
Downloading and setting up a server
Configuring your development environment
Testing your setup
Simplifying servlet and JSP deployment
Locating files in Tomcat, JRun, and Resin
Organizing projects into Web applications
Topics in Chapter:
The basic structure of servlets
A simple servlet that generates plain text
A servlet that generates HTML
Servlets and packages
Some utilities that help build HTML
The servlet life cycle
How to deal with multithreading problems
Tools for interactively talking to servlets
Servlet debugging strategies
Topics in Chapter:
Reading individual request parameters
Reading the entire set of request parameters
Handling missing and malformed data
Filtering special characters out of the request parameters
Automatically filling in a data object with request parameter values
Dealing with incomplete form submissions
Topics in Chapter:
Reading HTTP request headers
Building a table of all the request headers
Understanding the various request headers
Reducing download times by compressing pages
Differentiating among types of browsers
Customizing pages according to how users got there
Accessing the standard CGI variables
Topics in Chapter:
Format of the HTTP response
How to set status codes
What the status codes are good for
Shortcut methods for redirection and error pages
A servlet that redirects users to browser-specific pages
A front end to various search engines
Topics in Chapter:
Format of the HTTP response
Setting response headers
Understanding what response headers are good for
Building Excel spread sheets
Generating JPEG images dynamically
Sending incremental updates to the browser
Topics in Chapter:
Understanding the benefits and drawbacks of cookies
Sending outgoing cookies
Receiving incoming cookies
Tracking repeat visitors
Specifying cookie attributes
Differentiating between session cookies and persistent cookies
Simplifying cookie usage with utility classes
Modifying cookie values
Remembering user preferences
Topics in Chapter:
Implementing session tracking from scratch
Using basic session tracking
Understanding the session-tracking API
Differentiating between server and browser sessions
Encoding URLs
Storing immutable objects vs. storing mutable objects
Tracking user access counts
Accumulating user purchases
Implementing a shopping cart
Building an online store
Topics in Chapter:
Understanding the need for JSP
Evaluating the benefits of JSP
Comparing JSP to other technologies
Avoiding JSP misconceptions
Installing JSP pages
Surveying JSP syntax
Topics in Chapter:
Static vs. dynamic text
Dynamic code and good JSP design
The importance of packages for JSP helper/utility classes
JSP expressions
JSP scriptlets
JSP declarations
Servlet code resulting from JSP scripting elements
Scriptlets and conditional text
Predefined variables
Servlets vs. JSP pages for similar tasks
Topics in Chapter:
Understanding the purpose of the page directive
Designating which classes are imported
Specifying the MIME type of the page
Generating Excel spreadsheets
Participating in sessions
Setting the size and behavior of the output buffer
Designating pages to handle JSP errors
Controlling threading behavior
Topics in Chapter:
Using jsp:include
to include pages at request time
Using <%@ include ... %>
(
the include
directive) to include files at page translation time
Understanding why jsp:include
is usually better
than the include
directive
Using jsp:plugin
to include applets for the Java Plug-in
Topics in Chapter:
Understanding the benefits of beans
Creating beans
Installing bean classes on your server
Accessing bean properties
Explicitly setting bean properties
Automatically setting bean properties from request parameters
Sharing beans among multiple servlets and JSP pages
Topics in Chapter:
Understanding the benefits of MVC
Using RequestDispatcher to implement MVC
Forwarding requests from servlets to JSP pages
Handling relative URLs
Choosing among different display options
Comparing data-sharing strategies
Forwarding requests from JSP pages
Including pages instead of forwarding to them
Topics in Chapter:
Motivating use of the expression language
Invoking the expression language
Disabling the expression language
Preventing the use of classic scripting elements
Understanding the relationship of the expression language to the MVC architecture
Referencing scoped variables
Accessing bean properties, array elements, List elements, and Map entries
Using expression language operators
Evaluating expressions conditionally
Topics in Chapter:
Connecting to databases: the seven basic steps
Simplifying JDBC usage: some utilities
Using precompiled (parameterized) queries
Creating and executing stored procedures
Updating data through transactions
Using JDO and other object-to-relational mappings
Topics in Chapter:
Configuring a DSN to connect to Microsoft Access
Installing and configuring MySQL
Creating databases and users in MySQL
Installing and configuring Oracle9i
Using the Database Configuration Assistant to create a database in Oracle9i
Manually creating a database in Oracle9i
Creating users in Oracle9i
Testing your database through a JDBC connection
Determining the JDBC version of your database driver
Setting up the example music
table
Topics in Chapter:
Data submission 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
Groups of controls
Tab ordering
A Web server for debugging forms
Java
Java SE 7 API
Java SE 8 API
Java SE Downloads for Windows, Linux, & Solaris
Java SE Downloads for MacOS 10.6
Java EE 6 API.
Includes the servlet 3.0, JSP 2.2, and JSF 2.0 APIs.
Java EE 6 Technologies.
Includes servlet 3.0, JSP 2.2, JSTL 1.2, and JSF 2.0 specifications
Java EE 5 API.
Includes the servlet 2.5, JSP 2.1, and JSF 1.1 APIs.
Java 7 Programming Tutorial
Java 8 Tutorial: Lambdas, Streams, & More
Java 7 & 8 Training Courses
Recommended Java Programming Books
General Java Programming Resources
JSF (JavaServer Faces)
Servlets & JSP
Ajax, GWT, & JavaScript
Spring, Hibernate, & JPA
Struts