Java EE 5 Development using GlassFish Application Server:
The complete guide to installing and configuring the GlassFish Application Server and developing Java EE 5 applications to be deployed to this server
www.PACKTPUB.com  FREE ONLINE EDITION: Read full chapters online, download free samples from the book and more...
Book Contents Index > Chapter 2
Introduction
1: Getting Started with GlassFish
2: Servlet Development and Deployment
3: JavaServer Pages
4: Database Connectivity
5: JSP Standard Tag Library
6: JavaServer Faces
7: Java Messaging Service
8: Security
9: Enterprise JavaBeans

10: Web Services
11: Beyond Java EE

Appendix A: Sending Email from Java EE Applications

Appendix B: IDE Integration

Index

Latest Updates

Free Chapter:

Chapter 6: JavaServer Faces [ 892 kB PDF]

Code Download

Contact us

Chapter 2: Servlet Development and Deployment

In this chapter, we will discuss how to develop and deploy Java servlets. Some of the topics covered are:

  • An explanation of what servlets are
  • Developing, configuring, packaging and deploying our first servlet
  • HTML form processing
  • Forwarding HTTP requests
  • Redirecting HTTP responses Persisting data across HTTP requests

What is a Servlet? A servlet is a Java class that is used to extend the capabilities of servers that host applications. Servlets can respond to requests and generate responses. The base class for all servlets is javax.servlet.GenericServlet, this class defines a generic, protocol-independent servlet.

By far, the most common type of servlet is an HTTP servlet; this type of servlet is used in handling HTTP requests and generating HTTP responses. An HTTP servlet is a class that extends the javax.servlet.http.HttpServlet class, which is a subclass of javax.servlet.GenericServlet.

A servlet must implement one or more methods to respond to specific HTTP requests. These methods are overridden from the parent HttpServlet class. As can be seen in the following table, these methods are named so that knowing which one to use is intuitive.

Chapter 2: Servlet Development and Deployment

  • Writing Our First Servlet
  • Compiling the Servlet
  • Configuring the Servlet
  • Packaging the Web Application
  • Deploying the Web Application
  • Testing the Web Application
  • Processing HTML Forms
  • Request Forwarding and Response Redirection
    • Request Forwarding
    • Response Redirection
  • Persisting Application Data across Requests
  • Summary
   

 

Paperback 400 pages
Released: October 2007
ISBN: 1847192602
ISBN 13: 978-1-847192-60-8

     

 




View the book details
on PacktPub.com

 


 
  This website is owned and maintained by Packt Publishing Ltd, 2007. All rights reserved. Terms and Conditions