ServletException (Java EE 5)

Java EE API


javax.servlet Class ServletException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by javax.servlet.ServletException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
UnavailableException

public class ServletException
extends Exception

Extends: Throwable > Exception

定义 servlet 遇到困难时可抛出的一般异常。
英文文档:

Defines a general exception a servlet can throw when it encounters difficulty.

Author:
Various
See Also:
Serialized Form

Constructor Summary
 
Method Summary
 Throwable
 
Methods inherited from class java.lang.Throwable
 
Methods inherited from class java.lang.Object
 

Constructor Detail

public ServletException()
构造新的 servlet 异常。
英文文档:

ServletException

public ServletException()
Constructs a new servlet exception.


public ServletException(String message)
构造带指定消息的新 servlet 异常。该消息可以写入到服务器日志和/或向用户显示。
message 指定异常消息文本的 String
英文文档:

ServletException

public ServletException(String message)
Constructs a new servlet exception with the specified message. The message can be written to the server log and/or displayed for the user.

Parameters:
message - a String specifying the text of the exception message


public ServletException(String message, Throwable rootCause)
当 servlet 需要抛出异常并且需要包含有关妨碍 servlet 正常操作的“根本原因”异常的消息时,构造一个新 servlet 异常,该异常包含一条描述消息。
message 包含异常消息文本的 String
rootCause 防碍 servlet 正常操作的 Throwable 异常,使此 servlet 异常成为必需的
英文文档:

ServletException

public ServletException(String message,
                        Throwable rootCause)
Constructs a new servlet exception when the servlet needs to throw an exception and include a message about the "root cause" exception that interfered with its normal operation, including a description message.

Parameters:
message - a String containing the text of the exception message
rootCause - the Throwable exception that interfered with the servlet's normal operation, making this servlet exception necessary


public ServletException(Throwable rootCause)
当 servlet 需要抛出异常并且需要包含有关妨碍 servlet 正常操作的“根本原因”异常的消息时,构造一个新 servlet 异常。该异常消息以底层异常的本地化消息为基础。

此方法调用 Throwable 异常的 getLocalizedMessage 方法获取本地化异常消息。在子类化 ServletException 时,可重写此方法以创建设计用于特定语言环境的异常消息。

rootCause 防碍 servlet 正常操作的 Throwable 异常,使此 servlet 异常成为必需的

英文文档:

ServletException

public ServletException(Throwable rootCause)
Constructs a new servlet exception when the servlet needs to throw an exception and include a message about the "root cause" exception that interfered with its normal operation. The exception's message is based on the localized message of the underlying exception.

This method calls the getLocalizedMessage method on the Throwable exception to get a localized exception message. When subclassing ServletException, this method can be overridden to create an exception message designed for a specific locale.

Parameters:
rootCause - the Throwable exception that interfered with the servlet's normal operation, making the servlet exception necessary

Method Detail

public Throwable getRootCause()
返回导致此 servlet 异常的异常。
return 导致此 servlet 异常的 Throwable
英文文档:

getRootCause

public Throwable getRootCause()
Returns the exception that caused this servlet exception.

Returns:
the Throwable that caused this servlet exception


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!