I was searching for exact difference between javax.servlet.http.HttpServlet
, javax.servlet.GenericServlet and javax.Servlet unable to
-->GenericServlet can process multiple clients request from a single form. Whereas, HttpServlet can process multiple clients requesting from multiple HTML forms.
--> GenericServlet is Stateless and HttpServlet is Stateful.
"Exact difference" meaning what? The API lists the exact differences.
Servlet is an interface defining what a servlet must implement.
GenericServlet is just that, a generic, protocol-independent servlet.
HttpServlet is a servlet tied specifically to the HTTP protocol.
Are you asking when you'd use any of those?
In general, you'd extend HttpServlet to implement an application's web layer.
You might implement Servlet if you're writing your own container or handling everything yourself. You might extend GenericServlet to handle a different protocol, but you might not.
All classes, interfaces, and methods present in the javax.servlet package are protocol independent (generic to all protocols).
In contrast, all classes, interfaces, and methods present in the javax.servlet.http package are protocol dependent (specific to the HTTP protocol)