Explain the purpose of servlet interface.- The javax.servlet.HttpServlet / javax.servlet.Servlet is the interface that is to be implemented by all the servlets.
- The servlet’s code / actions / implementation is done by implementing this interface.
- The developers need to implement this interface when the application demands , or their application can not / chooses not to inherit from the GenericServlet or HttpServlet.
- For instance the RMI / CORBA that simulates the servlets will need to directly implement this interface.
- The life cycle methods, one init(), one or more service() and one destroy() will be implemented, and invoked by the network service.
- In addition to the life cycle methods, this interface can be used to return information about itself such as version, author, copyright etc.
|