This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

About ResultSet problem!  RSS feed

 
Robert James
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Turnpage JavaBean file is here ..


Test.jsp is here ...





Test.jsp Execute result is

Pages:4
Total:32
error

Would you like to tell me why the ResultSet rs didn't return .
Thanks a lot.
[ May 06, 2005: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Do you really think that this is a good way to deal with exceptions?

What's likely happening is that your code is throwing an exception and it is getting "eaten" by your catch block. Never, ever do this!

Either catch the exception and deal with it properly, or let it propogate outward so that the container can deal with it. By "eating" the exception as you have done here, you end up with head-scratching problems such as this.
 
Robert James
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'am Beginner. I don't know how to deal with this exception. in your opinion how you will do..

please help me change my code , make it work . thanks a lot. i hope the code ResultSet doesn't return null .
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At a bare minimum, log it:

This way you can go back to your log files and see what the problem was.

Further than that, ask yourself. What do I want to do if the code in this block fails -- redirect to an error page, continue showing an empty table?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since such an exception almost always means that either there's a bug in your code, or that the database itself is hosed, I let such exceptions propogate out to the container where the error handling mechansim that can be set up in web.xml causes a user-friendly "Oops!" page to be presented while logging the details of the error for me to diagnose.
[ May 07, 2005: Message edited by: Bear Bibeault ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!