Building Web Apps in Java:
Beginning & Intermediate Servlet & JSP Tutorials

Interested in training from the author of these tutorials? See the upcoming JSP & servlet training courses courses in Maryland (co-sponsored by Johns Hopkins Engineering for Professionals, or contact hall@coreservlets.com for info on customized courses at your location.


The beginning and intermediate-level tutorials on this page were originally based on the second edition of Marty's book Core Servlets and JavaServer Pages, but have been extensively upgraded since then, including coverage of servlets 3.0 and JSP 2.2 (e.g., for Tomcat 7). The materials have been tested by Marty in live training courses in the US, Canada, Australia, Puerto Rico, Japan, Mexico, India, Norway, and the Philippines. Click on a topic below to get the detailed tutorial, download the source code, or try out exercises on the topic. Also see the advanced servlet and JSP tutorials for topics like filters, Web app security, listeners, custom tag libraries, and use of the Spring Framework in Web applications. In addition, the training materials home page has tutorials on many other Java-related topics, including Ajax and JSF 2.0, two recommended next steps after learning servlets and JSP.

To arrange a servlet & JSP course at your organization based on these materials, contact hall@coreservlets.com. These courses can be customized to use any combination of the materials on the J2EE tutorials site, 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.

If you find these free tutorials helpful, we would appreciate it if you would link to us. Send corrections or feedback on any tutorial to hall@coreservlets.com. You can also add Marty on LinkedIn.


Servlets & JSP: Overview and Setup

Deploying Apps to the Johns Hopkins Server

This section is only directly applicable to graduate students in the Johns Hopkins University "Engineering for Professionals" program; it discusses details of uploading WAR files to the JHU Tomcat server. However, the general principles are applicable to any developer: test in your local Eclipse/Tomcat environment, make a WAR file, upload the WAR file to the production server, test again with the only changes to URLs being changing "localhost" to the host name of the production server.

Servlet Basics

Handling the Client Request: Form Data

Handling the Client Request: HTTP Request Headers

Generating the Server Response: HTTP Status Codes

Generating the Server Response: HTTP Response Headers

Handling Cookies

Session Tracking

JSP Introduction & Overview

Invoking Java Code with JSP Scripting Elements

Controlling the Structure of Generated Servlets: The JSP page Directive

Including Files and Applets in JSP Pages

Using JavaBeans Components in JSP Documents

The Model View Controller (MVC) Architecture: Integrating Servlets and JSP

The JSP 2 Expression Language: Simplifying MVC and Access to Java Code

Creating Custom JSP Tag Libraries: The Basics

Creating Custom JSP Tag Libraries: Advanced Topics

Advanced Topics

The tutorials in this section cover basic and intermediate servlet and JSP programming techniques. See the advanced servlet and JSP tutorials section for information on JSTL, filters, listeners, web.xml details, declarative security, programmatic security, custom tag libraries, using the Spring Framework in Web applications, and more. For those supporting very, very old servers, you can also access the version 1.0 servlet tutorial and JSP tutorial. <

PowerPoint Files for University Faculty

The PDF files in this tutorial contain the complete text of the original PowerPoint files, so if your goal is learning this technology, just stick with this tutorial. However, as a service to instructors teaching full-semester courses at accredited universities, coreservlets.com will release the original PowerPoint files for free. Please see the instructor materials page for details.

More Information

Java

JSF (JavaServer Faces)

Servlets & JSP
Ajax, GWT, & JavaScript

Spring, Hibernate, & JPA

Struts