• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NullPointerException while forwarding a request

 
Amit Kumar Thakur
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
why i am getting a the NullPointerException in the following code at line 74. Thanks
LoginValidation.java


ShowRequest.jsp

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Where is ShowRequest.jsp located with respect to the context root? Your path assumes that it is in the root.

Also, why do you have Java code in your JSP? That's a really bad practice that has been obsolete for over 12 years.
 
Amit Kumar Thakur
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear Bibeault,
I am using Eclipse to run this program and ShowRequest.jsp is located in WebContent Folder.
I am getting following error
exception

org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:413)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
controller.LoginValidation.doGet(LoginValidation.java:74)
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)


root cause

java.lang.NullPointerException
org.apache.jsp.ShowRequest_jsp._jspService(ShowRequest_jsp.java:68)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
controller.LoginValidation.doGet(LoginValidation.java:74)
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

 
Amit Kumar Thakur
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bear Bibeault,
as per your suggestion i have removed few java parts from Jsp and the program is as follows

and Costomer.jsp is as follows

but I am getting NullPointerException in LoginValidation at line 81 while login as a customer.
 
deepak veyan
Greenhorn
Posts: 10
Java MySQL Database Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You will have to ensure that Customer.jsp is at the root level.Is login with manager role working fine ?
 
Amit Kumar Thakur
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Deepak,
It is working fine with the manager role.
 
deepak veyan
Greenhorn
Posts: 10
Java MySQL Database Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should then be a problem within your Customer.jsp. Can you try replacing the content inside the page with some dummy text ? Then you could go about by debugging the code inside in case this works fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic