table of contents

Advanced Servlet and JSP

Tutorials and Training Materials

The advanced servlet and JSP tutorials on this page are based on Marty's book More Servlets and JavaServer Pages, and have been tested by Marty in live training courses in the US, Canada, Australia, Puerto Rico, Japan, Mexico, and the Philippines. The PDF versions of the tutorials are freely available to anyone for personal use. These versions contain the complete text of the PowerPoint slides, and are what you want if your goal is to learn or review the technology. As a courtesy, coreservlets.com also makes the original PowerPoint slides available to faculty teaching courses that do not compete with Marty's live courses. See the J2EE instructor materials page for details.

To arrange an onsite training course on servlets, JSP, Struts, JSF, Ajax, GWT, Java 5, Java 6, or a related topic at your organization, contact hall@coreservlets.com. These courses can be customized to use any combination of the materials shown here, and new materials can be added for specific client needs. To learn more details about the instructor, the curriculum for the live training courses, or the public course schedule, please see http://courses.coreservlets.com.

Source Code

Source code for all examples in these tutorials can be downloaded from the More Servlets & JSP source code archive.


Servlets and JSP: A Review of the Basics

View PDF of Servlet Review of the Basics
Free for personal use.

Topics:


The Model View Controller (MVC) Architecture

View PDF of MVC
Free for personal use.

Topics:

  • 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

The JSP 2.0 Expression Language

View PDF of JSP Expression Language
Free for personal use.

Topics:

  • Motivating use of the expression language
  • Understanding the basic syntax
  • 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

Using and Deploying Web Applications

View PDF of Web Applications
Free for personal use.

Topics:

  • Purpose of Web applications
  • Structure of Web applications
  • Setting up Web applications with Tomcat
  • Sharing data among Web applications

Controlling Web Application Behavior: The Deployment Descriptor web.xml

View PDF of web.xml
Free for personal use.

Topics:

  • Location and purpose of web.xml
  • Custom URLs
  • Initialization parameters
    • Servlets
    • JSP Pages
  • Preloading pages
  • Welcome pages
  • Error pages

Declarative Web Application Security

View PDF of Declarative Security
Free for personal use.

Topics:

  • Major security concerns
  • Declarative vs. programmatic security
  • Using form-based authentication
  • Using BASIC authentication

Programmatic Security

View PDF of Programmatic Security
Free for personal use.

Topics:

  • Problems with declarative security
    • The advantages of declarative security usually outweigh the disadvantages. But not always.
  • Combination security: mixing server-managed and servlet-managed (programmatic) security
    • Solve one of the drawbacks of declarative security with only a little bit of extra work.
  • Pure programmatic security
    • Solve the other drawbacks, but with a very lot of extra work.

Servlet and JSP Filters

View PDF of Servlet and JSP Filters
Free for personal use.

Topics:

  • Filter basics
  • Accessing the servlet context
  • Using initialization parameters
  • Blocking responses
  • Modifying responses
  • An abstract ModificationFilter
  • An abstract ReplaceFilter
  • More Info: Updated source code here. These examples have been updated significantly since the book was published, so the code is substantially different than in the More Servlets & JSP source code archive used for much of the rest of the tutorials. The sample code is bundled as a MyEclipse project, but can easily be used in regular Eclipse or without an IDE.

The Web Application Life-Cycle Events Framework

View PDF of Event Listeners
Free for personal use.

Topics:

  • Reason for listeners
  • Monitoring creation and destruction of the servlet context
  • Detecting changes in servlet context attributes
  • Recognizing session creation and destruction
  • Watching for changes in session attributes
  • Combining activities

Creating Custom JSP Tag Libraries: The Basics

View PDF of Custom Tags Basics
Free for personal use.

Topics:

  • Java-based tags
    • Components of a tag library
    • Basic tags
    • Tags that use attributes
    • Tags that use body content
    • Tags that optionally use body content
  • JSP-based tags (tag files)
    • Components of a tag library
    • Basic tags
    • Tags that use attributes
    • Tags that use body content
  • More Info: Updated source code here. These examples have been updated to JSP 2.0, so the code is substantially different than in the More Servlets & JSP source code archive used for much of the rest of the tutorials. The sample code is bundled as a MyEclipse project, but can easily be used in regular Eclipse or without an IDE.

Creating Custom JSP Tag Libraries: Advanced Topics

View PDF of Advanced Custom Tags
Free for personal use.

Topics:

  • Tags with dynamic attribute values
  • Tags with complex objects for attributes
  • Manipulating the tag body
  • Looping tags
  • Nested tags
  • Using SAX and TagLibraryValidator to validate tag library syntax
  • More Info: Updated source code here. These examples have been updated to JSP 2.0, so the code is substantially different than in the More Servlets & JSP source code archive used for the rest of the tutorials. The sample code is bundled as a MyEclipse project, but can easily be used in regular Eclipse or without an IDE.

The JSP Standard Tag Library (JSTL)

View PDF of JSTL
Free for personal use.

Topics:

  • Obtaining JSTL documentation and code
  • The JSTL Expression Language
  • Looping Tags
  • Conditional Evaluation Tags
  • Database Access Tags
  • Other Tags

Accessing Databases with JDBC

View PDF of JDBC
Free for personal use.

Topics:

  • Overview of JDBC technology
  • JDBC drivers
  • Seven basic steps in using JDBC
  • Using JNDI with JDBC
  • Retrieving data from a ResultSet
  • Using prepared and callable statements
  • Submitting multiple statements as a transaction

Sample Exercises

View PDF of Exercises
Free for personal use.

The the live training courses are in lecture/lab format, and these are a sample of the exercises. There is one set of exercises for each topic of the tutorials, and the exercises are meant to illustrate the most important techniques of that topic. You will learn a lot more by doing exercises in conjunction with reading the tutorials than by reading alone. Try them!
Sorry: solution sets are only given out in the classes.