-1

Mainly error is shown in "if" section. "org.apache.jasper.JasperException: An exception occurred processing JSP page [/enquiryForm_processing.jsp] at line [52]" is the error.

Code:

<%@page import="com.Package3.*"%>

<%String saved=EnquirySaving.savingFunction(name, address, email, mobile, gName, gMobile, time, career1, career2, career3, career4, hear1, hear2, hear3, hear4, hear5, before, institution, courses, status, councelling, visitDate, othersSpecify, othersSpecify1, othersSpecify2);%>  


<%if(saved.equals("success")){%>
    <%response.sendRedirect("loginPage.jsp");%>
<%}else{%>
    <%response.sendRedirect("enquiryForm_processing_failed.jsp");%>
<%}%>
cнŝdk
  • 31,391
  • 7
  • 56
  • 78

1 Answers1

1

If the NullPointerException exception is coming from the if block line, it means that the expression saved.equals("success") is causing the problem, from which we can deduce that saved variable is null and you are trying to call a method on it.

You need to check for it's nullability before trying to call a method on it:

if(saved != null  && saved.equals("success"))

A better recommendation is to inverse your expression and call .equals() on your constant string, in order to avoid the NullPointerException:

"success".equals(saved)
cнŝdk
  • 31,391
  • 7
  • 56
  • 78