wood burning stoves
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
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: 63355

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] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: getting null pointer exeception
It's not a secret anymore!