This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Exception in init Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Servlets
Bookmark "Exception in init" Watch "Exception in init" New topic

Exception in init

Nijeesh Balan
Ranch Hand

Joined: Oct 09, 2000
Posts: 116
If an exception occurs in doPost or doGet method of the servlet we redirect it to an errorjsp.
We are looking up for the Home Object in init() method. If this process fails the response object is not available for redirecting. How do we handle this?
Any suggestions would be highly appreciable.

Thanks & Regards,<br />Nijeesh.
selva kumar

Joined: May 15, 2002
Posts: 2
Have a boolean filed as false initially
and when u get an exception while look up of ur home, catch it within the init and in the catch block change the boolean value to true
then in the doPost or on doGet method just before doing any processing check first the value of the boolean,
if true (exception has occured) redirect to
proper error page
if false ( no exception has occured ) simply walk through...

-----------------Chance favours the prepared mind---------------------<br />M Selvakumar<br />Senior Software Engineer<br />IT Solutions (India) Private Ltd.,<br /># 6, 6/1, Pycrofts Garden Road,<br />Chennai - 600 006<br />Phone : +91-044 2821 2877, 78 Extn:2423<br />Email :<br />Website : <a href="" target="_blank" rel="nofollow"></a>
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Exception in init
It's not a secret anymore!