File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes getting null pointer exeception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "getting null pointer exeception" Watch "getting null pointer exeception" New topic

getting null pointer exeception

padma patil
Ranch Hand

Joined: Nov 06, 2001
Posts: 41
I am geeting Null pointer exception if any of the fields which I am selecting in JSP are NULL.
HOw to deal with NULL values in JSP code.
I am using mysql database.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63874

The same way you would deal with them in any other Java code. Test before you use the reference.
For example:

A useful idiom in JSP:

Another, to safely compare strings when the parameter might be null:

[ April 11, 2002: Message edited by: Bear Bibeault ]

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: getting null pointer exeception
It's not a secret anymore!