File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Handling 404 Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Handling 404 Error" Watch "Handling 404 Error" New topic

Handling 404 Error

SanjeevKumar Chauhan

Joined: Oct 02, 2005
Posts: 2
Hi All,
Please let me know how to handle the requirement in servlets given below:

1. GET :
A request could come from a web browser or a telnet client 2
Handling of errors such as �URI not found� has to be taken care
2. PUT :
Server should be able to dump the body of a PUT request to a file specified by the URI in the request line. It should return the correct message to the client as well. This part should work correctly with a telnet client.
Your server should be able to delete the file specified in the URI of a DELETE request. It should return the correct message to the client. This part should work correctly with a telnet client.

Please let me know to handle these scenarios as Iam quite new to Servlets

Thanks & Regards
SK Chauhan

Thanks<br />SK Chauhan
Srivatsa Katta
Ranch Hand

Joined: Aug 13, 2005
Posts: 55

Usually for hadling error code, v use

in the web.xml, and customize PageNotFound.jsp with whatever message u want.
But i am not sure the same thing works will all kinds of requests, and i feel its not dependent on the type of request. so this should work for all kinds of request if i am not wrong.

I agree. Here's the link:
subject: Handling 404 Error
Similar Threads
Is Exception handling there
Sending request headers manually
ICE 287 answers for WebSphere 5.0
Get rid of line numbers
IBM HttpServer and websphere Appserver