Skip to Main Content
Java Servlet Programming, 2nd Edition
book

Java Servlet Programming, 2nd Edition

by Jason Hunter, William Crawford
April 2001
Intermediate to advanced content levelIntermediate to advanced
780 pages
23h 48m
English
O'Reilly Media, Inc.
Content preview from Java Servlet Programming, 2nd Edition

Name

ServletException

Synopsis

Class Name: javax.servlet.ServletException

Superclass: java.lang.Exception

Immediate Subclasses: javax.servlet.UnavailableException

Interfaces Implemented: None

Availability: Servlet API 1.0 and later

Description

A generic exception thrown by servlets encountering difficulties.

Class Summary

public class ServletException extends java.lang.Exception {
  // Constructors
  public ServletException();                                 // New in 2.0
  public ServletException(String msg);
  public ServletException(String msg, Throwable rootCause);  // New in 2.1
  public ServletException(Throwable rootCause);              // New in 2.1
  public Throwable getRootCause();                           // New in 2.1
}

Constructors

public ServletException()

public ServletException()
public ServletException(String msg)
public ServletException(String msg, Throwable rootCause)
public ServletException(Throwable rootCause)
Description

Constructs a new ServletException, with an optional descriptive message and an optional “root cause” for the exception. If a message is specified, it can be retrieved by calling getMessage( ); if a root cause is specified, it can be retrieved by calling getRootCause( ). The messages and root cause are usually included in server logs and user error messages. The constructor versions taking a root cause were introduced in Servlet API 2.1.

Instance Methods

getRootCause()

public Throwable getRootCause()
Description

Returns the Throwable object that caused the servlet exception or null if there was no root cause. This method was introduced in ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Servlet Programming

Java Servlet Programming

Jason Hunter

Publisher Resources

ISBN: 0596000405Supplemental ContentErrata Page