Can any one help on this topic ?

Hi friends !!

I have a new "doubt" .... in Servlet programming, we normally over-ride doGet( ) or doPost( ) ( or sometimes even the service( ) method ! ) methods.... there, we can redirect the user to some error page in case something bad happens, using RequestDispatcher or this or that ...!!

BUT, my doubt is , HOW to accomplish the same thing IF I encounter some error in grabbing some resources ( like DAtabase Connections ...etc.) inside my INIT( ) method ... ?!!!!

Is there any provision for doing this in TomCat ( 4.0 or 5.0 ) ? In WebSphere 5.0 ?

Awaiting your replies,

Thanx & regards,

"Raghu"

[670 byte] By [phenom123] at [2007-9-30 4:10:36]
# 1

There is no way of directing to an error page in the init method - there is no request, and nowhere to send a response to!.

You can always catch exceptions, and print out error messages to log files. You can even have it email you (providing that email is working :-)I suppose you could also set an error flag in the init method so that any subsequent requests will get redirected to the error page.

Cheers,

evnafets

evnafets at 2007-6-29 17:54:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...