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 Avoid 404 error in request and responce object 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 "Avoid 404 error in request and responce object" Watch "Avoid 404 error in request and responce object" New topic
Author

Avoid 404 error in request and responce object

Anup Srivastava
Greenhorn

Joined: Dec 21, 2005
Posts: 21
How can i avoid 404 error in request and responce object. and forward it to user define page.
Anup Srivastava
Greenhorn

Joined: Dec 21, 2005
Posts: 21
i want that if the end user give wrong url, then instead of giving 404 error it must display user define page. how can i come to know from request and response objects that the server has thrown 404 error.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

You can't as such, since you only get access to the request and response when the server finds the resource. But, you can define your own 404 page in the web.xml and then do your own processing there. Is this what you're looking for?
Satish Chilukuri
Ranch Hand

Joined: Jun 23, 2005
Posts: 266
You can handle the 404 error with the error-page element in web.xml



The "error.jsp" is the custom page that you will display to the user.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Avoid 404 error in request and responce object
 
Similar Threads
how to call the html form
Error Redirection w/Params?
JMeter : Response Path
Regarding tomcat
Q. HttpSession object