• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Custom 404 error page

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I added the following lines in web.xml and there is a 404.html in my root directory. It didn't work. Can any friend help me with it? Thanks in advance.
<error-page>
<error-code>404</error-code>
<location>404.html</location>
</error-page>
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The URL must begin with a '/' -- and is relative to the root of the Web App (check out the web.xml schema to confirm)
so try this:
 
pam jiao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jessica Sant:
The URL must begin with a '/' -- and is relative to the root of the Web App (check out the web.xml schema to confirm)
so try this:


-----------------------------------
Thanks Jessica. I tried it and still didn't work. Any other suggestions?
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did you use the whole path? something like /webapps/text/404.html? but the path should be specific to your directory structure.
 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just a guess here: it may depend on which server you are using, but you may have to reload/restart the application to get the server to re-read the web.xml file.
 
pam jiao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Philip Shanks:
Just a guess here: it may depend on which server you are using, but you may have to reload/restart the application to get the server to re-read the web.xml file.


---------------------------------
Thanks you all. I'm using weblogic server. I did use the full path and restart the server after changing in web.xml. More ideas?
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It did not work...does that mean nothing gets displayed. make sure that the error is not being caught. Also assuming you are using IE, make sure the setting to suppress server generated error messages is not set.
 
pam jiao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bosun Bello:
It did not work...does that mean nothing gets displayed. make sure that the error is not being caught. Also assuming you are using IE, make sure the setting to suppress server generated error messages is not set.


------------------------------------
Thanks Bosun. I changed the setting and it's working now. Also thanks you all for your kind responses.
 
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic