GeeCON Prague 2014*
The moose likes Servlets and the fly likes nullpointerexception in a bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "nullpointerexception in a bean" Watch "nullpointerexception in a bean" New topic
Author

nullpointerexception in a bean

Komal Amaresh
Ranch Hand

Joined: Oct 06, 2008
Posts: 67
Hi,

I' am retrieving data in HashMaps for multiple columns to be displayed in a jsp from two database tables. As I' am calling the data from two tables, the columns set as the key in each hashmap is not present in both tables. Thereby passing the values in a bean to be displayed on a jsp returns a null pointer exception as the keys for all the values are not the same. In such cases, the data on the jsp the data may be be set as a blank column. but first i need a way to handle the nullpointerexception.
Please help me.

Thanks in advance,
regards,
Komal
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

try to debug and find the line which cause NullPointerException. also post your code *part*.

by the way: I feel your explanation(question) is not clear
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Well simply check if the target object is null.
 
GeeCON Prague 2014
 
subject: nullpointerexception in a bean