• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception Handling

 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my servlet i'm calling a Stateless bean.
If any exception occurs in the bean while processing the reques, thn how can i throw that exception from the bean to the invoked servlet.

Thanks
Srini
[ October 09, 2004: Message edited by: srini vasan ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Servlets forum.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just like you would catch any exception thrown in any Java class. Although some people might have better ideas for handling Exceptions once they reach a Servlet, so that the user can get a nice message instead of a stack trace.

Mark
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Spritzler:
Just like you would catch any exception thrown in any Java class. Although some people might have better ideas for handling Exceptions once they reach a Servlet, so that the user can get a nice message instead of a stack trace.

Mark


Thank you yaar .. i got the sln .

i thought we cant use the " throw exception "clause in the bean, b'coz if a throws clause is used in a method it shd either have a try & corresponding catch or a throws Clause, since the bean has a signature mentioned in the remote interface, that throws remote exception, i thought i cant add one more exception..

Srini
 
Senthil B Kumar
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Throwing proper Exception from the Bean is the right way to handle the exception. Instead of letting the Servlet to handle the Exception. You can print the Stack Trace on the Server Side (Log) , so that it may help you to debug.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic