Interfaces
- Servlet Interface: This is the interface that declares life cycle methods of Servlet. So the reason, any of your classes to behave as Servlet must implement the Servlet Interface (or) extend any class that implemented Servlet Interface
Methods of Servlet Interface
|
|
void init(ServletConfig scin)
throws ServletException
|
This initializes the Servlet. Using the scin, we can get
the initialization parameter details.
|
void service (ServletRequest req, ServletResponse res)
throws ServletException, IOException
|
- ServletConfig Interface: This is the interface that helps the servlet to get the configuration related details
Methods of ServletConfig Interface
|
|
String getInitPararneter (String param)
|
Returns values of initialization parameters
|
ServletContext getServletContext( )
|
- ServletContext Interface: This is the interface that helps the servlet to get the environment related details
Methods of ServletContext Interface
|
|
String getServerInfo( )
|
Returns information about server.
|
Object getAttribute(String attr)
|
Returns the value of the server attribute (attr).
|
void log(String s)
|
Writes content of 's' to the servlet log.
|
void setAttribute(String attr, Object val)
|
Sets the attribute specified by attribute lattr to the
value passed in 'val'.
|