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 Servlet runtime exceptions 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 "Servlet runtime exceptions" Watch "Servlet runtime exceptions" New topic
Author

Servlet runtime exceptions

Al Coholic
Greenhorn

Joined: Jul 05, 2001
Posts: 1
Hi,
Does anyone know of the servlet equilvalent to the JSP directive <%@ page errorpage = "someurl" %>? I need to catch any runtime exceptions any display a clean message.
Putting try/catch blocks is not an option. We have about 500-600 class files and a change this late will be too critical.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

IMO, it would have to be a

Any other thoughts.
regds.
- satya
ps: I read your stmt abt try/catch not an option.

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
"Putting try/catch blocks is not an option."
Well you are not going to catch exceptions any other way, but you only need to have try/catch at the servlet doGet - doPost level. I generally enclose practically all the code in doGet or doPost in a try/catch - be sure to log the result as well as try to write a HTML page with the exception stack trace.
Bill
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"Al Coholic" ? A little too much Bart Simpson, I think,
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Obviously fake names are not appropriate in a professional community such as this. Please log in with a new name which meets the requirements.
Thanks.

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Thomas Mcfarrow
Ranch Hand

Joined: Jul 09, 2001
Posts: 137
Hi,
According to the book "Core JSP" the <%@ page errorpage = "someurl" %> will deal with any uncaught exceptions.
"This allows the JSP author to deal with any uncaught expcetions and present a nice looking front-end page to the client"
This is how you would deal with exceptions without a try/catch clause.
Does anyone know if there is a servlet equivalant?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet runtime exceptions
 
Similar Threads
doGet exceptions
Unchecked & Checked Exceptions
Pls help me on Checked Exceptions
Design issue- should ActionServlet catch all exceptions
Exception Doubt