Explain why HttpServlet is declared abstract.
Answer
The Constructor HttpServlet() does nothing because this is an abstract
class. Default implementations in a few Java classes like HttpServlet don’t
really do anything. Hence, they need to be overridden.
Usually one of the following methods of HttpServlet must be overridden by a
subclass:
doGet, if the servlet supports HTTP GET requests
doPost, HTTP POST requests
doPut, HTTP PUT requests
doDelete, HTTP DELETE requests
init and destroy, to manage resources
getServletInfo, to provide information
However, there doesn’t seem to be any reason why the service method should be
overridden because it eventually dispatches the task to one of the doXXX
methods.
What is the GenericServlet class?
Answer
GenericServlet makes writing servlets easier. To write a generic
servlet, all you need to do is to override the abstract service method.
More Servlets links
Answer - The Constructor HttpServlet() does nothing because this
is an abstract class.........
Answer - Yes, it is possible to have a constructor for a
servlet.......
Answer - Applets are applications designed to be
transmitted over the network......
Answer - In some organizations, the intranet is blocked
by a firewall to the internet..........
|