*
The moose likes IDEs, Version Control and other tools and the fly likes NullPointerException while forwarding a request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "NullPointerException while forwarding a request" Watch "NullPointerException while forwarding a request" New topic
Author

NullPointerException while forwarding a request

Amit Kumar Thakur
Greenhorn

Joined: Jun 26, 2013
Posts: 6
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

Joined: Jan 10, 2002
Posts: 60740
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Amit Kumar Thakur
Greenhorn

Joined: Jun 26, 2013
Posts: 6
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

Joined: Jun 26, 2013
Posts: 6
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

Joined: May 02, 2012
Posts: 10

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

Joined: Jun 26, 2013
Posts: 6
Hello Deepak,
It is working fine with the manager role.
deepak veyan
Greenhorn

Joined: May 02, 2012
Posts: 10

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NullPointerException while forwarding a request
 
Similar Threads
Login Code Error
Can get mysql DB connection from class, but can't get from servlet.
Problem in updating the fields to database
Login Servlet
Help with this code!