Why do we need Java servlets?

Basically Java Servlet is Java Class, for any web application to handle the Http request common Java Classes doesn’t possess the capability. To make Java class deal with HTTP or any other protocol request we make Ordinary Java class as Servlet with some configuration. Registering it to Deployment Descriptor and extending the Java class to GenericServlet or Http Servlet, adding the servlet api to build path of application.

Now here also if programmer needs the servlet to Handle only HTTP protocol requests then should go with extending Http Servlet and if want to deal with any sort like : HTTP/FTP etc. then should extend Generic Protocol.