• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception in Bean creation

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Trader Joey
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can I have a try catch block for the <jsp:usebean ..> tag ?
Nikhil
 
Trader Joey
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried it. It works.
 
reply
    Bookmark Topic Watch Topic
  • New Topic