JSP – Exception handling with deployment descriptor

Home/JSP Tutorial/JSP - Error and exception handling/JSP – Exception handling with deployment descriptor
JSP – Exception handling with deployment descriptor 2017-06-13T10:37:43+00:00

InputData.html :


 


Calculator.jsp :


 


Error.jsp :


 


Web.xml :


 


NOTE : web.xml (deployment descriptor) file is available in WEB-INF folder at WebRoot.

 

Input the integer value in textfields and click ADD button.

The browser display the below message,

Addition = 11

Now, input the float value in any of the textfield and click ADD button so the browser display the message,

Your page generates an Exception.
For input string: “6.3”

This deployment descriptor entry means that whenever a web component throws a NumberFormatException from any web page in the whole application(web project), the web container call the Error.jsp file, which simply reports the error message in web browser.

Prev Next