Java Reference
In-Depth Information
The init() Method
public void init()
throws ServletException
B
This parameterless implementation of the init() method is provided only for convenience. It
prevents a derived servlet from having to store the ServletConfig object. init() has no para-
meters and returns no value.
It throws this exception:
ServletException
The log(java.lang.String message) Method
public void log(java.lang.String message)
This log() method takes the passed-in message and the name of the servlet and writes them to
a log file. The location of the log is server specific. log() returns no value and throws no
exceptions.
It has one parameter:
java.lang.String
The log(java.lang.String message, java.lang.Throwable t)
Method
public void log(java.lang.String message,
java.lang.Throwable t)
This log() method takes the passed-in message and Throwable object and logs the message
with a stack trace from the Throwable object. log() returns no value and throws no excep-
tions.
It has two parameters:
java.lang.String
java.lang.Throwable
The service() Method
public void service(ServletRequest request,
ServletResponse response)
throws ServletException,
java.io.IOException
The service() method defines the servlet's entry point for servicing requests. It can be exe-
cuted only after the servlet's init() method has executed successfully. The service() method
is the life cycle method executed for every incoming request. It returns no value.
 
Search WWH ::




Custom Search