Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  

How do I throw a 404 error from within a java servlet?



Share on Google+Share on Google+

Java Coder
How do I throw a 404 error from within a java servlet?
1 Answer(s)      3 years and a month ago
Posted in : Servlet Interview Questions

How you can write code in Servlet for throwing the httpd error 404?

How to add the configuration for handling the not found error in the web.xml file?


View Answers

July 7, 2014 at 12:28 PM


Add the following code in the web.xml file:


and in the servlet you can use the following code:

public void doGet(HttpServletRequest request, HttpServletResponse response) {

Check more Servlet tutorials.



Related Tutorials/Questions & Answers: