Servlets is a Java based technology for server side processing. Other languages or technologies for server side processing are PHP, JSP, node.js, Perl etc.
Definition of a Servlet
A servlet is a special Java class which is dynamically loaded on the server and used to generate dynamic content.
Following are the general steps that happen when a client requests a servlet:
- Client sends a HTTP request from web browser containing a URL with servlet.
- Web server receives the request and forwards the request to application server.
- Using information available in xml (deployment descriptor) the servlet container loads the object appropriate servlet class.
- If required, the servlet retrieves data from database, processes it and sends the response back to web server.
- Web server forwards the response back to the client who sent the request.
Above steps can be illustrated as follows:
Features of Servlets
Following are the features of servlets:
- High-level
- Component-based
- Platform independent
- Server independent
- High performance (overcomes CGI limitation)
- Highly scalable
CGI vs. Servlets
Following are the differences between Common Gateway Interface (CGI) and Servlets:
Servlet Container
Servlet container or servlet engine is a set of objects that provides the runtime environment for servlets. Servlet container manages the life cycle of a servlet.
Following functionality is provided by the servlet container:
- Network services
- Decoding and encoding of MIME based messages
- Servlet life cycle management
- Resource management
- Security
- Session management
Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.
He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.
He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.
Very useful and interesting. Thankyou for sharing this Great article