File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

Exception in init

Nijeesh Balan
Ranch Hand

Joined: Oct 09, 2000
Posts: 116
Hi,
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.
TIA,
Nijeesh.


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

Joined: May 15, 2002
Posts: 2
Hi,
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 : selvakumar.muthukrishnan@itsprojects.com<br />Website : <a href="http://www.itsprojects.com/" target="_blank" rel="nofollow">http://www.itsprojects.com/</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in init
 
Similar Threads
Context
init() and constructor combined?
please help in simple jsp application
what is the ServletConfig and usage
JDBC Connection