SQL Oracle Java JSP JDBC MORE

JSP Exception Implicit Object


In JSP, exception is a instance of java.lang.Throwable and used for Exception Handling.

This object is only available for error pages and used for print Exception.

index.html

<html>
<head>
<title>Exception Implicit Object</title>
</head>
<body>
<form action="action.jsp">
First Number:<input type="text" name="fno" />
Second Number:<input type="text" name="sno" />
<input type="submit" value="submit"/>
</form>
</body>
</html>
<%@ page errorPage="exception.jsp" %>
<%
String num1=request.getParameter("fno");
String num2=request.getParameter("sno");
int s1= Integer.parseInt(num1);
int s2= Integer.parseInt(num2);
int exp= s1/s2;
out.print("Output is: "+ exp);
%>
<%@ page isErrorPage="true" %>
Got this Exception: <%= exception %>

Output

Exception JSP exception