• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem in retriving List objects

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, i am trying to print values in a jsp page Customer.jsp taken from AccountDetailDAO. At first page goes through LoginValidation but i am getting NullPointerException in line 83.
It works fine when i am login as a manager.
Here are the relevant codes
LoginValidation.java

Customer.jsp

AccountDetailDAO
 
author & internet detective
Posts: 41907
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which line is line 83?
 
Amit Kumar Thakur
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have already marked that in LoginValidaion.java .
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the getDispatcher method takes path as an argument. most probably the path here is wrong. Try checking that.. you may try /Customer.jsp
 
Author
Posts: 116
11
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A null pointer will occur if a method is called on an object that is null and according to the API doc the getRequestDispatcher() method "returns null if the servlet container cannot return a RequestDispatcher".

I attempted to replicate this in my environment without success. I am using Tomcat 7 and if the path argument in the getRequestDispatcher() is not valid it does not throw a null pointer exception, instead the servlet sends an HTTP 404 message code to the browser.

Investigating this further I found this post by Charles Lyons that talks in detail about this: https://coderanch.com/t/453276/java-Web-Component-SCWCD/certification/RequestDispatcher-null-outcome. It appears that server implementation determines the behaviour.

Would you post the stack trace if correcting the path does not solve it.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic