JSP Exception implicit object (original) (raw)

Last Updated : 16 May, 2026

In Java, JSP is defined as JavaServer Pages. It is the technology that is used to create dynamic web pages in Java. The Exception implicit object in the JSP provides information about any exception that occurs during the execution of the JSP pages. It helps developers display meaningful error information to users.

Steps to Use Exception Object

**Program to Implement Exception Implicit Object of JSP

Below is a working code example to demonstrate the implementation of Exception Implicit Object of JSP.

HTML `

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

Exception Implicit Object Example <% try { // Attempting division by zero to trigger an exception int result = 10 / 0; out.println("Result: " + result); } catch (Exception e) { // Handling the exception and accessing exception information out.println("

Error Details:

"); out.println("

Exception Type: " + e.getClass().getName() + "

"); out.println("

Message: " + e.getMessage() + "

"); out.println("

Stack Trace:

"); out.println("
");
            e.printStackTrace(new java.io.PrintWriter(out));
            out.println("
"); } %>

`

**Explanation: The code shows how the exception implicit object handles runtime errors in JSP. A division by zero is used to generate an exception, which is caught and displayed with its type, message, and stack trace on the web page.

Output:

Below we can see the detailed output in browser.

Output Screen

Important Concepts of Exception Handling