javax.servlet package has interfaces and classes which define a framework in which servlets can operate. Let's first make a walk through of all the interfaces and methods and its description.
Interfaces in javax.servlet :-
Servlet Interface: This interface has the init( ), service( ), and destroy( ) methods that are called by the server during the life cycle of a servlet. Following are the method in Servlet interface :-
void destroy( ):- Executed when servlet is unloaded from the web server memory.
ServletConfig getServletConfig() :- Returns back a ServletConfig object that contains initialization data.
String getServletInfo( ):- Returns a string describing the servlet.
init method :- Called for first time when the servlet is initialized by the web server.
void service() method :- Called to process a request from a client.
ServletConfig Interface:- This interface is implemented by the servlet container. Servlet can access any configuration data when its loaded. The methods declared by this interface are summarized here: Following are the methods in ServletConfig interface:-
ServletContext getServletContext():- Gives the servlet context.
String getInitParameter(String param):- Returns the value of the initialization parameter named param.
Enumeration getInitParameterNames():- Returns an enumeration of all initialization parameter names.
String getServletName():- Returns the name of the invoking servlet.
rn