aspose file tools
The moose likes Servlets and the fly likes error-page!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "error-page!!!" Watch "error-page!!!" New topic
Author

error-page!!!

kriti sharma
Ranch Hand

Joined: Feb 16, 2001
Posts: 160
i have put the following lines in web.xml

<error-page>
<error-code>500</error-code>
<location>/logo.html</location>
</error-page>

and called response.sendError(500);

but the page is not found by the server.what is the mistake?

if i make my own exception classes extending ServletException, for my web app will this work?

<error-page>
<exception-type>MyException</exception-type>
<location>/logo.html</location>
</error-page>
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
first question: where did you put the logo.html? The given URI is relative to the webserver root, not the web application root!

second question: no. The codes are for standard HTTP error codes, not Java exceptions.


42
kriti sharma
Ranch Hand

Joined: Feb 16, 2001
Posts: 160
NO: the URI is wrt to the web app root!!i am working on weblogic i which there is only one root and that is your web-app root.the concept of web-server root is with tomcat where you have to put your web-app folder in parallel to the web-server ROOT directory which is the defalut web-app.

my directory structure:
HelloWorld
.........../web-inf
...................../classes
..............................HelloWorld.class
...................../web.xml
.........../index.html
.........../temp
.................logo.html
[ July 16, 2004: Message edited by: kriti sharma ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56529
    
  14

I don't see the probem. The URL you specify for the error page should be context-relative, so you should be ok there. I'm not sure what else the problem might be. What error message are you seeing?

And yes, you can declare error handlers for your own exceptions. For example:



Be sure to use the full classname for the exception class.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: error-page!!!
 
Similar Threads
Error Page Problem
error-page!!!
error-page element in web.xml
Exception Handling
web.xml and error-page