This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes ServletException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ServletException" Watch "ServletException" New topic
Author

ServletException

suman.pulikond a
Greenhorn

Joined: Jul 31, 2005
Posts: 11
What actually happens if i throw a ServletException from doPost()?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

The container will clean up the request.
If an error page was defined for ServletException, it will be shown.
If an error page was defined for ServletException.getRootCause, it will be shown.
Otherwise, an ugly browser defined error page will be shown.


[My Blog]
All roads lead to JavaRanch
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
You will get error page specific to error code 500.


Rahul Bhattacharjee
LinkedIn - Blog
suman.pulikond a
Greenhorn

Joined: Jul 31, 2005
Posts: 11
not that, what happens to the servlet? will the container destroys instance or thread?
nelson christos
Ranch Hand

Joined: Aug 08, 2006
Posts: 57
destroy() is only called once all threads within the servlet's service method have exited or after a timeout period has passed.


i think therefore i am
nelson christos
Ranch Hand

Joined: Aug 08, 2006
Posts: 57
destroy() is only called once all threads within the servlet's service method have exited or after a timeout period has passed.
nelson christos
Ranch Hand

Joined: Aug 08, 2006
Posts: 57
destroy() is only called once all threads within the servlet's service method have exited or after a timeout period has passed.
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Calling of the destroy method is totally upon the mercy of the container.Probably when you bring down the server (or, bring down a context using container manager) then it calls destroy method of all the sevlets.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
If you want a servlet to take itself out of action due to some problem, throw an javax.servlet.UnavailableException - the servlet container will then not even try to send it requests.

Bill
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60817
    
  65

"suman.pulikond a",

You have previously been warned on one or more occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post.

Your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Initials for a last name are not acceptable.

Be aware that accounts with invalid display names are removed.

bear
JavaRanch Sheriff
[ October 10, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ServletException
 
Similar Threads
overrides javax.servlet.http.HttpServlet.doGet and doPost
ServletException from destroy( )
servlet Exceptions
what's wrong when i create new jdbc provider?
ServletException()