0

I have a struts program which is fetching data from db. In the front end (jsp) I'm giving a condition which will not fetch any data(data for that condition is not there in db). When I execute the code I'm getting a null pointer exception because it is not fetching any data. This is code is working fine if there is data present in db for the specified conditions. I have exception handlers. These handlers handle the exception and show an error message to user. But in this case if data is not there in db I want to display a message to user saying 'No data found'. I'm checking the list in jsp (using jstl) whether it is empty or not.But the execution is not coming to the jsp since it is handled by exception handler. can any one help me with this ?

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
Saran
  • 1
  • 1
  • Hard to debug without any code. – Compass Apr 14 '17 at 18:01
  • why would you expect the resultset to be anything other than null if you are requesting data that does not exist in the db? you should catch the exception or check for null before attempting to use the resultset object. – RAZ_Muh_Taz Apr 14 '17 at 18:02
  • Possible duplicate of [What is a NullPointerException, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it) – alayor Apr 14 '17 at 18:03
  • sorry I don't have the code with me right now.. It's just a simple select statement like – Saran Apr 14 '17 at 18:09

0 Answers0