O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Servlet & JSP: A Beginner's Tutorial

Book Description

Servlet and JavaServer Pages (JSP) are the underlying technologies for developing web applications in Java. They are essential for any programmer to master in order to effectively use frameworks such as JavaServer Faces, Struts 2, or Spring MVC. Covering Servlet 3.1 and JSP 2.3, this book explains the important programming concepts and design models in Java web development as well as related technologies and new features in the latest versions of Servlet and JSP. With comprehensive coverage and a lot of examples, this book is a guide to building real-world applications.

Table of Contents

  1. Introduction
    1. Servlet/JSP Application Architecture
    2. The Hypertext Transfer Protocol (HTTP)
    3. About This Book
    4. Downloading the Sample Applications
  2. Chapter 1: Getting Started
    1. Downloading and Installing NetBeans
    2. Creating A Web Project with NetBeans
    3. Troubleshooting
    4. Creating A Servlet
    5. Behind the Scenes
    6. Starting, Stopping and Restarting Tomcat
    7. Monitoring HTTP Traffic
    8. Summary
  3. Chapter 2: The Servlet API
    1. Servlet API Overview
    2. Servlet
    3. Writing A Basic Servlet Application
    4. ServletRequest
    5. ServletResponse
    6. ServletConfig
    7. ServletContext
    8. GenericServlet
    9. HTTP Servlets
    10. HttpServletRequest
    11. Working with HTML Forms
    12. Using the Deployment Descriptor
    13. Summary
  4. Chapter 3: Session Management
    1. Hidden Fields
    2. Cookies
    3. HttpSession Objects
    4. Summary
  5. Chapter 4: JavaServer Pages
    1. An Overview of JSP
    2. Comments
    3. Implicit Objects
    4. Directives
    5. Scripting Elements
    6. Summary
  6. Chapter 5: The Expression Language
    1. A Brief History of the Expression Language
    2. The Expression Language Syntax
    3. Accessing JavaBeans
    4. EL Implicit Objects
    5. Using Other EL Operators
    6. Referencing Static Fields and Methods
    7. Creating Sets, Lists and Maps
    8. Accessing List Elements and Map Entries
    9. Manipulating Collections
    10. Formatting Collections
    11. Formatting Numbers
    12. Formatting Dates
    13. Configuring the EL in JSP 2.0 and Later Versions
    14. Summary
  7. Chapter 6: JSTL
    1. Downloading JSTL
    2. JSTL Libraries
    3. General-Purpose Actions
    4. Conditional Actions
    5. Iterator Actions
    6. Formatting Actions
    7. Functions
    8. Summary
  8. Chapter 7: Writing Custom Tags
    1. Custom Tag Overview
    2. Simple Tag Handlers
    3. SimpleTag Example
    4. Handling Attributes
    5. Manipulating the Tag Body
    6. Writing EL Functions
    7. Distributing Custom Tags
    8. Summary
  9. Chapter 8: Tag Files
    1. Introduction to Tag Files
    2. Your First Tag File
    3. Tag File Directives
    4. doBody
    5. invoke
    6. Summary
  10. Chapter 9: Listeners
    1. Listener Interfaces and Registration
    2. Servlet Context Listeners
    3. Session Listeners
    4. ServletRequest Listeners
    5. Summary
  11. Chapter 10: Filters
    1. The Filter API
    2. Filter Configuration
    3. Example 1: Logging Filter
    4. Example 2: Image Protector Filter
    5. Example 3: Download Counter Filter
    6. Filter Order
    7. Summary
  12. Chapter 11: Application Design
    1. Model 1 Overview
    2. Model 2 Overview
    3. Model 2 with A Servlet Controller
    4. Model 2 with A Filter Dispatcher
    5. Validators
    6. Dependency Injection
    7. Summary
  13. Chapter 12: Deployment
    1. Deployment Descriptor Overview
    2. Deployment
    3. Web Fragments
    4. Summary
  14. Appendix A: HTML
    1. Getting Started
    2. Working with Text
    3. Links
    4. Images
    5. Lists
    6. Tables
    7. Forms
    8. Multimedia
  15. Appendix B: Cascading Style Sheets
    1. Overview
    2. Applying Styles
    3. Web Colors
    4. Selectors
    5. Styling Text
    6. Styling Boxes
    7. Styling Links
    8. Styling Lists
    9. Styling Tables
    10. Styling Forms
  16. Appendix C: Tomcat
    1. Downloading and Configuring Tomcat
    2. Starting and Stopping Tomcat
    3. Defining A Context
    4. Defining A Resource
    5. Installing TLS Certificates
  17. Appendix D: Web Annotations
    1. HandlesTypes
    2. HttpConstraint
    3. HttpMethodConstraint
    4. MultipartConfig
    5. ServletSecurity
    6. WebFilter
    7. WebInitParam
    8. WebListener
    9. WebServlet