This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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.

It is sorta covered in the JavaRanch Style Guide.
subject: Handling 404 Error
Similar Threads
IBM HttpServer and websphere Appserver
Is Exception handling there
Sending request headers manually
ICE 287 answers for WebSphere 5.0
Get rid of line numbers