Download
FAQ History |
API
Search Feedback |
What Is a Servlet?
A servlet is a Java programming language class that is used to extend the capabilities of servers that host applications access via a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by Web servers. For such applications, Java Servlet technology defines HTTP-specific servlet classes.
The
javax.servlet
andjavax.servlet.http
packages provide interfaces and classes for writing servlets. All servlets must implement theServlet
interface, which defines life-cycle methods. When implementing a generic service, you can use or extend theGenericServlet
class provided with the Java Servlet API. TheHttpServlet
class provides methods, such asdoGet
anddoPost
, for handling HTTP-specific services.This chapter focuses on writing servlets that generate responses to HTTP requests. Some knowledge of the HTTP protocol is assumed; if you are unfamiliar with this protocol, you can get a brief introduction to HTTP in HTTP Overview.
Download
FAQ History |
API
Search Feedback |
All of the material in The J2EE(TM) 1.4 Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.