aspose file tools*
The moose likes Servlets and the fly likes STrange error with error-page in web.xml 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 "STrange error with error-page in web.xml" Watch "STrange error with error-page in web.xml" New topic
Author

STrange error with error-page in web.xml

Caesar Dutta
Ranch Hand

Joined: Sep 18, 2004
Posts: 30
Hi,

My web application structure is as follows:

SendError {contains index.html, form.html}
|
|__WEB-INF {contains web.xml}
|
|_classes

index.html
-------------
<html><title>What is this</title>
<body>This is my body</body>
</html>

form.html
---------
<html>
<body>
This is an error page
<body>
</html>

web.xml
-------
<web-app>
<error-page>
<error-code>200</error-code>
<location>/form.html</location>
</error-page>

</web-app>

I am testing this in Sun Java Application Server, BeaWeblogic, and finally
Tomcat 5.0

If I take out the portion <error-page>...</error-page> from web to xml
then on http://localhost:85/SendError is giving the index .html.

But if I put the block back in web.xml the output is from form.html.

If anybody can help, on what is happening I will be very grateful.

Thanks,

Caesar
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

Originally posted by Caesar Dutta:
Hi,

web.xml
-------
<web-app>
<error-page>
<error-code>200</error-code>
<location>/form.html</location>
</error-page>

</web-app>


But if I put the block back in web.xml the output is from form.html.



Caesar ,

First of all 200 is not an error code.
Whenever a request is processed , response can be categorized as




200 is a success code, You should not put it in <error-page> tag.
on every successful request server will return 2xx response and you will never be able to see any other code if 200 is place inside your <error-page> tag.


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Caesar Dutta
Ranch Hand

Joined: Sep 18, 2004
Posts: 30
Thanks Shailesh so much. I put 9000 and it worked.

Thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: STrange error with error-page in web.xml
 
Similar Threads
error-page tag facing problem
Getting problem with post method
web.xml error page
web.xml error page
Tomcat 5.5 - application development