0

I have a jsp page which can throw some exceptions. I have another JSP page - catchError.jsp this should be displayed whenever the exception occurs in any of the JSP pages.

I have added below code into catchError.jsp

<%@ page isErrorPage="true" %>

And my JSP page - displayDetails.jsp has below code, here I have introduced arithmetic exception for demo purpose.

<%@ page errorPage="catchError.jsp" %>
<% int div = 10/ 0; %>

I am getting null pointer exception whenever I am trying to access displayDetails.jsp. It should throw arithmetic exception ideally, which will then get redirected to catchError.jsp.

stack trace:

org.springframework.web.util.NestedServletException: View rendering failed; nested exception is java.lang.NullPointerException

javax.portlet.PortletException: org.springframework.web.util.NestedServletException: View rendering failed; nested exception is java.lang.NullPointerException

Per my guess, the system is unable to find catchError.jsp in error page attribute itself. Any reason why this is happening and any suggestion on how I can proceed.

Ragas
  • 147
  • 12
  • Sorry but the link provided is generic null pointer. Mine is jsp specific and related to errorPage attribute – Ragas Aug 27 '20 at 07:04
  • be that as it may, your problem is a NullPointer, whether that is in a jsp, in a Swing form or when calling an element from a List, a NullPointer is a NullPointer, the cause for that doesn't (can 't) change. – Stultuske Aug 27 '20 at 07:18

0 Answers0