File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes error-page!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
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: 60810
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: error-page!!!
 
Similar Threads
web.xml and error-page
Exception Handling
error-page!!!
Error Page Problem
error-page element in web.xml