What is Servlet

What is Servlet

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.

Servlet-Request-Response-Model

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,

  • GenericServlet
  • HttpServlet
  • ServletRequest
  • ServletResponse
  • javax.servlet.http contains HTTP specific servlet classes

Servlet Overview

  • 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 Releases

  • 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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值