Latest

recent

The Java Servlet API


The Java Servlet API is a set of Java classes which define a standard interface between a Web client and a Web servlet. Client requests are made to the Web server, which then invokes the servlet to service the request through this interface.

The Java Servlet API is a Standard Java Extension API, meaning that it is not part of the core Java framework, but rather, is available as an add-on set of packages. 

The API is composed of two packages:

❑  javax.servlet
❑  javax.servlet.http

The javax.servlet package contains classes to support generic protocol-independent servlets. This means that servlets can be used for many protocols, for example, HTTP and FTP. The javax.servlet.http package extends the functionality of the base package to include specific support for the HTTP protocol.

The Servlet interface class is the central abstraction of the Java Servlet API. This class defines the methods which servlets must implement, including a service() method for the handling of requests. The GenericServlet class implements this interface, and defines a generic, protocol-independent servlet. To write an HTTP servlet for use on the Web, we will use an even more specialized class of GenericServlet called HttpServlet.

HttpServlet provides additional methods for the processing of HTTP requests such as GET (doGet method) and POST (doPost method). Although our servlets may implement a service method, in most cases we will implement the HTTP specific request handling methods of doGet and doPost
The Java Servlet API Reviewed by 1000sourcecodes on 23:34 Rating: 5
Powered by Blogger.