• Post Reply Bookmark Topic Watch Topic
  • New Topic

"Page not found" exception  RSS feed

 
aakash bhatt
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my web application I would like to customize ""Page not found" exception to my user defined exception message.
so when ever user request to a given page , which does not exist should should my user defined exception

How could i do this?

Thanks,
aakash
 
Sudharsan Govindarajan
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your web application's web.xml needs to have the following entry.
<error-page>
<error-code>404</error-code>
<location> your_custom_error.page</location>
</error-page>

hth,
Sudharsan
[ August 23, 2004: Message edited by: Sudharsan G'rajan ]
 
Mike Berna
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing to keep in mind. The error page you specify must be at least 512 bytes or IE will revert to the IE file not found error page (not the customized page).

For more info:
http://www.404-error-page.com/404-error-page-too-short-problem-microsoft-ie.shtml

Good Luck!
[ August 25, 2004: Message edited by: Mike Berna ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, been burned by that one. Doncha just love IE?

<hack-alert>
If all else fails, put a large HTML comment in your page to force it over the limit.
</hack-alert>
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!