aspose file tools*
The moose likes JSP and the fly likes Simple yet frustrating - Need exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Simple yet frustrating - Need exceptions" Watch "Simple yet frustrating - Need exceptions" New topic
Author

Simple yet frustrating - Need exceptions

mannie chaihan
Greenhorn

Joined: Feb 15, 2004
Posts: 5
Ok.. I created an error.jsp page to output my exceptions.
I specified it as an error page <%@ page isErrorPage="true" %>
my main page is specified to use this error page. <%@ page errorPage="error.jsp"%>
and my bean code I print out the exception:
catch (Exception e) {System.out.println(e.getMessage());}
What i'm I doing wrong?
Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 452
Hello mannie,
what were u expecting??
do u want that the exception generated in ur bean class should be displayed in error.jsp. For that you dont have to catch the exception, so that web-container catches that exception and forwards the control to error.jsp.


Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
mannie chaihan
Greenhorn

Joined: Feb 15, 2004
Posts: 5
oh sorry.. yes.. that is what i'm expecting
solution from java form
Ok.. I throw and I catch.. but neither e.toString() or e.getMessage() is giving me anything???
mannie chaihan
Greenhorn

Joined: Feb 15, 2004
Posts: 5
ok.. i'm such a greenhorn.. I didn't even have a real exeception!!
argg.. thanks anyhow. :roll:
mannie chaihan
Greenhorn

Joined: Feb 15, 2004
Posts: 5
No It really should be an execption..
I'm trying to get a resultset.next() on an empty result set.
This should throw and exception from inside the bean..

And nothing gets printed on my page
Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 452
two things:
First
calling resultset.next() on empty resultset wont throw an exception.
Second:
You are explicitly catching exception in your jsp, so even if some exception is generated it wont be handled by the web-container, and hence it wont be forwarded to error.jsp
mannie chaihan
Greenhorn

Joined: Feb 15, 2004
Posts: 5
hmmm...
Well when I get the string from the exception within the bean and return the string..
I'm able to print the exception and it's states something like "illegal operation on empty result set."
Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 452
when i said Empty ResultSet i meant that ur query was executed successfully but didn't fetched any record. In this case calling resultset.next() will return boolean false, not an exception. If you are getting an exception something is wrong else where.
As u have not provided enough data it is difficult for me to tell the exact cause of this exception.
Also what happened to ur main problem, that is displaying error in error.jsp, is it solved?
 
 
subject: Simple yet frustrating - Need exceptions