This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception in init

 
Nijeesh Balan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
selva kumar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic