What is Servlet
Last modified on July 27th, 2014 by Joe.
The Servlet is a type of Java class used in Java web applications which enhances the capabilities of a server. These Java servlets runs on a web application server container. These servlets are used to generate HTML content to be shown on the Web browser. At the lowest level it is nothing but a Java class.
Servlets are designed to respond to a request from user’s browser and send back response content. A servlet is mostly implemented for the HTTP protocol and thus the name HTTP Servlet. In the Java platform Servlets are used to generate the dynamic HTML content in general. They can also be used to create and respond with XML, excel, pdf, json and any other formats as required.
Servlet Request Response Model
In general, web browser will be the client in the servlet request response model. The browser will send a request and it will be served by a HTTP server. In the backend, HTTP server will utilize the services of a servlet container to generate the dynamic content.
Important classes and packages of the Servlet API are,
- javax.servlet.http contains HTTP specific servlet classes
- Servlet is a server-side technology in Java platform stack.
- Servlet responds to an incoming request from a browser client with a response.
- Though initially meant for generating HTML content in web application, nowadays used mostly at the controller layers.
- JSP has taken over the job of generating the HTML content. But under the hood, JSPs generate servlet classes, which is the real element responds to the requests.
- Servlet 3.1: May 2013: Non-blocking I/O, HTTP protocol upgrade mechanism
- Servlet 3.0: Dec 2009: Pluggability, Ease of development, Async Servlet, Security, File Uploading
- Servlet 2.5: Sep 2005: Requires JavaSE 5, supports annotation
- Servlet 2.4: Nov 2003: web.xml uses XML Schema
- Servlet 2.3: Aug 2001: Addition of Filter
- Servlet 2.2: Aug 1999: Becomes part of J2EE, introduced independent web applications in .war files
- Servlet 2.1: Nov 1998: First official specification, added RequestDispatcher, ServletContext
- Servlet 2.0: Jun 1998: Part of Java Servlet Development Kit 2.0
- Servlet 1.0: Jun 1997: Initial release
[…] are some of the tech jargons related to Java Servlet […]
[…] run the Java Servlets we need a Servlet container like Apache Tomcat. Before going into detail of installing the servlet […]
[…] tutorial is the standard Hello World program using Java Servlet. Using an IDE is the best choice to do development. It will help to increase the productivity. If […]