91-9990449935 0120-4256464 |
Servlet InterfaceServlet interface provides common behaviour to all the servlets. Servlet interface needs to be implemented for creating any servlet (either directly or indirectly). It provides 3 life cycle methods that are used to initialize the servlet, to service the requests, and to destroy the servlet and 2 non-life cycle methods. Methods of Servlet interfaceThere are 5 methods in Servlet interface. The init, service and destroy are the life cycle methods of servlet. These are invoked by the web container.
Servlet Example by implementing Servlet interfaceLet's see the simple example of servlet by implementing the servlet interface. It will be better if you learn it after visiting steps to create a servlet.File: First.java
Next TopicGenericServlet Class
|