aspose file tools*
The moose likes JSP and the fly likes Exception in Bean creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Exception in Bean creation" Watch "Exception in Bean creation" New topic
Author

Exception in Bean creation

Trader Joey
Ranch Hand

Joined: May 11, 2000
Posts: 33
I am using a bean within a JSP page. In the constructor of this bean is a call to a method that could throw an Exception. How does the JSP page know that an exception was thrown during the creation of an instance of the bean class?
Thanks
Nikhil
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Nikhil
The JSP knows an exception was thrown in the same way that any other part of your program knows. The exception will be thrown through the different layers of the code until it is either caught or it gets to the top most caller. IF it uncaught the entire way then your JSP will most likely send an HTML error page. Better yet, you could set the error page and then use the error information to customize the response to the user (or to yourself for debuging).


Dave
Trader Joey
Ranch Hand

Joined: May 11, 2000
Posts: 33
Can I have a try catch block for the <jsp:usebean ..> tag ?
Nikhil
Trader Joey
Ranch Hand

Joined: May 11, 2000
Posts: 33
I tried it. It works.
 
Don't get me started about those stupid light bulbs.
 
subject: Exception in Bean creation