• Post Reply Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher.forward ( ) exceptions can be gobbled up ???

 
john wesley
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I have a question about exceptions thrown by RequestDispatcher . forward ( ), can anyone kindly clarify this thing.

I am using RequestDispatcher . forward ( ) to redirect the browser to a static resource � an xls file. Now, I think I can be sure that it doesn�t throw any exceptions, since its forwarded to a static resource, so can I gobble up the exceptions ??

try
{ request.getRequestDispatcher("fullUserList.xls").forward(request,response);
}
catch(IOException e)
{

}
catch(ServletException e)
{

}





thanks.jw
 
Sravan Kumar
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

do u mean u can leave the catch block empty? I do not think that's a wise decision. You have to put a catch block anyway, so why not print the StackTrace?

Moreover, an exception can still occur if the Excel file is moved elsewhere under the context. That's just one cause. Exceptions are supposed to occur at Runtime, so why take a call when you are writing the code? :roll:
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by john wesley:
can I gobble up the exceptions ??


By the way, why you want it that way?
Isn't it better to catch the exception and handle it in a more appropriate way.
[ September 16, 2005: Message edited by: Adeel Ansari ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!