Java Reference
In-Depth Information
service()
has two parameters:
B
•
ServletRequest
•
ServletResponse
It throws these exceptions:
•
ServletException
•
java.io.IOException
The
getServletInfo()
Method
public java.lang.String getServletInfo()
The
getServletInfo()
method provides the servlet user with information about the servlet
itself. You will usually include copyright or versioning information.
getServletInfo()
has no
parameters and throws no exceptions.
It returns this value:
•
String
The
destroy()
Method
public void destroy()
The
destroy()
method is the life cycle method that marks the end of a servlet's life. It is exe-
cuted only once, when the servlet is removed from the service. You should place all of your
clean-up functionality in this method.
destroy()
has no parameters, returns no value, and
throws no exceptions.
The
ServletConfig
Interface
The
ServletConfig
interface defines an object generated by a servlet engine and passes con-
figuration information to a servlet during startup. It contains name/value pairs of initialization
parameters for the servlet. It also contains a reference to the
ServletContext
object, described
in the next section. The
ServletConfig
interface defines four methods for accessing this infor-
mation.
The
getServletContext()
Method
public ServletContext getServletContext()
The
getServletContext()
method returns a reference to the current
ServletContext
object.
getServletContext()
has no parameters and throws no exceptions.