Servlet Exception

The javax.servlet package specifies two exception classes: javax.servlet.ServletException and javax.servlet.UnavailableException.

The SevletException Class
public class ServletException extends java.lang.Exception
This is generic exception, which can be thrown by the init(), service(), doXXX(), and destroy() methods.

Constructor of ServletException class

  1. public ServletException();
  2. public ServletException(String message) ;
The UnavailableException Class
public class UnavailableException extends ServletException
javax.servlet.UnavailableException is a special type of servlet exception. Since this servlet extends the javax.servlet.ServletException, all servlet method that can throw a javax.servlet.Exception can also throw a javax.servlet.UnavailableException.
It is indicate to the web container that the servlet is either temporarily or permanently unavailable.

Constructor of UnavailableException class

  1. public UnavailableException(String message);
  2. public UnavailableException(String message, int seconds) ;


Latest Tutorial

Most Visited Tutorial