Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error code 404

 
Naresh Gangapur
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found this question in the mock exam, from - http://www.javaranch.com/carl/scwcd/scwcd_review.jsp

<error-page>
<error-code>404</error-code>
<location>/not_found.html</location>
</error-page>

The above entry in the Deployment Descriptor will do what?

A.Route any request to your web application for a page or servlet that
cannot be found to not_found.html

B. Route any ServletExceptions with the code 404 thrown from your servlet to
not_found.html

C. Route any exception thrown in a servlet to not_found.html

D. Route any 404 requests to not_found.html


Answer provided is A - but I thought even D would is also a correct answer. All requests ending in 404 would be server by not_found.html.

Please suggest.
 
Rohan kanade
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
answer D is not correct because there can be a 404 error outside the servlet and jsp container i.e the plain old web server like apache.

so only when the servlet/jsp container comes across a request for a resource which cannot be found, the resource can be a mapped servlet or jsp which can be directly requested by user or through a Dispatcher. Only then the not_found.html will be invoked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic