Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting null pointer exeception

 
padma patil
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
thanks,
padmashree
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

hth,
bear
[ April 11, 2002: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic