Servlet is a part of java technology which used for to create web application.
Servlet technology is used at server side and generates dynamic web page.
Servlet make robust and scaleable to web application of java language. Before Servlet, We were using Common Gateway Interface(CGI) scripting language and it was popular as a server-side programming language. But after some time we need improvement in server side technology.
Servlet API has many interfaces and classes such as Servlet, GenericServlet, HttpServlet, ServletRequest, ServletResponse etc.
Servlet can be introduced in many aspects :
Servlet technology is a web technology used to create web application.
Servlet technology is an complete web development API.
Servlet is also an interface which is must be implemented for creating any servlet.
Servlet is also a class that extend the capabilities of the servers and respond to the incoming request.
Servlet technology is a web component and container which is deployed on the server to create dynamic web page.
Advantage of Servlet
Web container creates threads for handling the multiple requests to the servlet. Threads share a common memory area, lightweight. Each process have own memory, it's not share memory with another process.
Better performance: Servlet creates a thread for each request not process.
Portability: Servlet uses java language.
Robust: Servlets are managed by JVM so no need to worry about momory leak, garbage collection etc.
Secure: Servlet uses java language.
HTTP (Hyper Text Transfer Protocol)
Http is the protocol that allows web servers and browsers to exchange data over the web.
Http is a request response protocol.
Http uses reliable TCP protocol connections.
It is stateless means each request is considered as the new request. In other words, server doesn't recognize the user bydefault.
http protocol used in servlet.
Http Request Methods
Every request has a header which invoke the status of the client. There are many request methods. Get and Post requests are mostly used.
The http request methods are:
GET
POST
HEAD
PUT
DELETE
OPTIONS
TRACE
0 Comment(s)