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

web.xml error-page not working

 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,
I am using Tomcat 5.5.25 and cannot get my error page to work. Do I have to enable something in Tomcat to tell it to use my error-page definitions in web.xml? I have spent way too much time on such an easy thing. Thanks

 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is not really a Struts problem. I'm moving it to the Servlets forum to increase the likelihood you'll get an aswer.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
When you say, "it's not working" what exactly do you mean?

Are you seeing the Tomcat default 404 page (will show 'Apache Tomcat' along with the version number.

Or.. Are you seeing a more generic looking 'page not found' screen?
 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi, sorry Ben. I get a Page Not Found.

I also tried adding:


But I also get a Page Not Found.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
This still doesn't answer my question.

What does the page not found screen look like?
Is it an Apache Tomcat page not found screen or is it more generic looking?
 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Report post to moderator




It has no apache.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
OK, it sounds like you might be looking at MSIE's 'Friendly Error Screen'

Go to Tools -> Options -> Advanced (tab) and uncheck the "Show Friendly Errors" checkbox.
Then try again.
 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Report post to moderator
Wow that was it. Thanks!

Any other advice around this setting, as far as how to code for this? Or is that just the way it will have to work for users with that setting?
 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Report post to moderator
If the Show Friendly URLs setting is set to true as defaulr in IE, then this web.xml error-page is going to be kindof not worthwhile isnt it?

Most of my users use IE and wouldnt even know how to modify this setting. Please let me know your thoughts.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Andy Hahn:

Most of my users use IE ....


There's your problem.



Seriously though.
MSIE sees the 404 status code and shows this page.
I've never tried this but try setting the status to 200 in your error jsp.

<% response.setStatus(200); %>
This should tell the browser that the request was valid and it will show your page instead of the 'Friendly Error Page'.
[ March 13, 2008: Message edited by: Ben Souther ]
 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Report post to moderator
Yeah that does work. Sweeeeet thanks!
 
kamalakannan kamal
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

but error-page is working fine with tomcat 4.1 without changing any settings in IE? what may be the reason for this?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
kamalakannan kamal,

Rather than tacking your new question onto someone else's old thread, create a new thread for yourself. It will stand a better chance of getting answered and nobody will accuse you of hijacking someone else's discussion.

You can refer to this thread with a link if you think the discussion here is relevant to your question.

-Ben
 
    Bookmark Topic Watch Topic
  • New Topic