Advertisement
Methods | Description |
---|---|
String getMessage() | This method gets the message related to the thrown exception. |
void printStackTrace() | This method prints Throwable obect and its the stack trace. |
void printStackTrace(PrintStream ps) | This method prints the Throwable object to the PrintStream object. |
void printStackTrace(PrintWriter pw) | This method prints the Throwable object to the PrintWriter object. |
String toString() | This method returns the description of Throwable object. |
Advertisement
<%@ page errorPage = "HandlingError.jsp" %>
<html>
<head>
<title>Using JSP config object</title>
</head>
<body>
<%
int a=10, b=0, c;
c=a/b; //ArithmeticException i.e. Divide by zero exception is thrown here
out.println(c);
%>
<br/>
</body>
</html>
<%@ page isErrorPage = "true" %>
<html>
<head>
<title>JSP exception object</title>
</head>
<body>
<h2> Handling JSP exception using exception object </h2>
<%
out.println("An exception is thrown by the web page - " + exception);
%>
</body>
</html>
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement