• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception Handling

 
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Please verify the answers to this question:
How can you redirect the request from a servlet to another resource if the servlet encounters an exception?
Select 2 correct options
a.This cannot be done unless the exception is caught in the servlet.
b.By specifying a mapping between exception class and the resource in web.xml.
c.This can be done only if the exception is a subclass of javax.servlet.ServletException.
d.This can be done even if the exact class of the exception is not known at compile time.
The answer says 'B' & 'D' are the correct options.
Isn't 'A' correct option too since to redirect the request from a servlet to another resource if the servlet encounters an exception we use include or forward method of RequestDispatcher to include or forward to another resource and this cannot be done unless the exception is caught in the servlet.
Thanks
Ravi
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
There is a mistake in what has been mentioned in above question.
The correct options are B & C.
According to me A should also be a correct option. Offcourse the question says select two options.
Thanks
Ravi
 
reply
    Bookmark Topic Watch Topic
  • New Topic