WHAT IS SERVLET???
In this modern era of the
internet, billion bytes of data is generated on a day-to-day basis. To
gain access to this humongous amount of data, every person is required
to send a request on the network and await a response. Most of us
believe in the misconception that all of these web applications are
created over web frameworks like HTML, PHP, JavaScript etc. But, did you
know, web applications can be based on Java using a service called Java
Servlets? In this article, let’s delve deep into Java Servlets and understand how this technology is useful for creating a web application.
Introduction to Web
Web is basically a system of Internet servers that supports formatted documents. The documents are formatted using a markup language called HTML (HyperText Markup Language) that supports links to other documents, like graphics, audio, and video files.
HTTP (Hypertext Transfer Protocol)
- HTTP is a protocol that clients and servers on the web to communicate.
- It is similar to other internet protocols such as SMTP (Simple Mail Transfer Protocol) and FTP (File Transfer Protocol.
- HTTP is a stateless protocol i.e it supports only one request per connection. This means that with HTTP the clients connect to the server to send one request and then disconnect. This mechanism allows more users to connect to a given server over a period of time.
- The client sends an HTTP request and the server answers with an HTML page to the client, using HTTP.
The HTTP request can be made using a variety of methods, but the ones which we use widely are Get and Post.
The method name itself tells the server the kind of request that is
being made, and how the rest of the message will be formatted.
Now, with the help of the below table, let’s understand the difference between Get and Post methods of HTTP.Get | Post |
1. Data is sent in the header body | 1. Data is sent in the request body |
2. Restricted to limited data transfer | 2. Supports a large amount of data transfer |
3. It is not secured | 3. It is completely secured |
4. It can be bookmarked | 4. It cannot be bookmarked |
Now, that you have learned a few basics of web, let’s jump to the core topic and understand the concept of a servlet
A servlet is a Java Programming language
class that is used to extend the capabilities of servers that host
applications accessed by means of 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. It is also a web
component that is deployed on the server to create a dynamic web page.
.
Comments
Post a Comment