Servlets are server side components that provide a powerful mechanism for developing server side programs. It is a small program that runs on a server. Servlets provide component-based, platform-independent methods for building Web-based applications, without the performance limitations of CGI programs. The Java Servlet API allows a programmer to add dynamic content to a Web server using the Java platform. The generated content is commonly HTML, but may be other data such as XML.
The Servlet API, contained in the Java package hierarchy
defines the expected interactions of a Web container and a servlet.
Servlets can also access a library of HTTP-specific calls, receive all the
benefits of the mature java language including portability, performance,
reusability, and crash protection. Today servlets are the popular choice for
building interactive web applications.
Recommend the tutorial