Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error-page!!!

 
kriti sharma
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
kriti sharma
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64972
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic