The servlet is a technology to create web applications. Web applications help the web server to build dynamic web contents (such as query of the database). Servlet generates HTML text. Servlets takes HTTP Request from a browser, generate dynamic web content and produced HTTP Response is sent back to the browser in the form of HTML.
Servlet Tutorials, above figure is a practical working of the Servlet concept. Where the client request the browser that capable of communicating with the server, the server accepts the request and finds the requested page, server formats the requested page gives that to the browser, where browser renders the content to visible format to the client. Actually Servlet is came to the picture to overcome the problems of CGI(Common Gateway Interface), the drawback of CGI is that If number of clients increases, it takes more time for sending response.
CGI is a standard route for a Web server to pass a Web client’s demand to an application program and to get information back to forward to the client. At the point when the client asks for a Web page , the server sends back the asked for page. Be that as it may, when a client rounds out a frame on a Web page and sends it in, it more often than not should be handled by an application program. The Web server ordinarily passes the frame data to a little application program that procedures the information and may send back an affirmation message. This technique or tradition for passing information forward and backward between the server and the application is known as CGI. It is a piece of the Web’s Hypertext Transfer Protocol (HTTP).