aspose file tools*
The moose likes Servlets and the fly likes What happens after servlet throws an exception? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "What happens after servlet throws an exception?" Watch "What happens after servlet throws an exception?" New topic
Author

What happens after servlet throws an exception?

Sam Zheng
Ranch Hand

Joined: Nov 29, 2000
Posts: 61

Hi everybody,
I have a question about exception handing in servlet.
If a servlet throws a ServletException in its service
method:
public void service(HttpServletRequest req,
HttpServletResponse res) throws ServletException{

}
What happens after this service throws the exception?
Who catches this ServletException?
Does the thread running the servlet die thereafter?
Thanks for your help! Sam
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
if the service method throws servlet exception, since the method delegates handling the exception to the caller of the method, the thread (the Server) that calls the method is responsible. The thread just exits.

Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
jQuery in Action, 2nd edition
 
subject: What happens after servlet throws an exception?