Introduction to Java Servlets CSE Seminar Topic:
Servlets are basically programming classes dealing the request-response communication between a sever and a client. Servlets are in Java platform of Sun Microsystems. Earlier the W3C authorities had utilized Common Gateway Interface (CGI) to to process vital information on internet. But CGI had lot of flaws such as creation of new process on each request which not only led to a decrease in server performance but also left it less secured. Application Programming Interface (API) was then brought as replacement for CGI but then it was like a one server associate and one small bug would bring the whole server down.
Sun introduced Servlets in order to overcome the disadvantages of its earlier predecessors. Based on the Object oriented concept servlets were more dynamic and secure. Servlets came under Java Enterprise Edition (J2EE) which also involved technologies such as Remote Method Invocation and Enterprise Java Beans to access legacy systems and also Java Database Connectivity (JDBC) which helps in connecting the front end and the back end.
A servlets is based on Java API which mainly is associated with HTTP protocol to generate a response based on a client’s request. Java Package contains the Servlet API’s and to deploy or run this servlets, web Containers are used. A servlet’s life cycle is defined based on public methods namely init(), service() and destroy(). While init method helps to initiate a web applet before processing a request, service method handles requests such as Get, Post which is processed by methods like doget() or dopost().
Parameters which servlets follow are:
• HTTP Servlet request parameter
• HTTP Servlet response parameter
Both the above parameters are controlled by HTTP Session class. Destroy method is called once before the servlets are de-boarded from further service.
There are 3 different types of Servlet attributes:
• Set
• Get
• Remove.
To run a servlet application, first it is copied into Java Web Server directory and the necessary path is given in the browser.
Download Java Servlets CSE Seminar Topic.