This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "nullpointerexception in a bean" Watch "nullpointerexception in a bean" New topic

nullpointerexception in a bean

Komal Amaresh
Ranch Hand

Joined: Oct 06, 2008
Posts: 67

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,
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

Joined: Nov 08, 2003
Posts: 3476

Well simply check if the target object is null.
I agree. Here's the link:
subject: nullpointerexception in a bean
Similar Threads
Difference in property="*" for jsp:setProperty and jsp:getProperty
Form Bean scope problem
Dynamic Data Input and Bean
Displaying a table in JSP using JSTL tags