Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP error handling does not work with Internet Explorer  RSS feed

 
ruhul islam
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a web application, and need to display some user friendly html/jsp pages if in case there is any server error. Iam working on weblogic 8.1 and Internet Explorer 6.0. As a test example, Iam trying to display a simple html page if there is an error 404 which signifies URL not found. Here is the sample code--
****form.html****
<form action="myjsp.jsp">
<input type="text">
<input type="submit" value="submit">
****error.html****
<h2> An Internal Server Error Has Occurred </h2>
****web.xml*****
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<error-page>
<error-code>404</error-code>
<location>/error.html</location>
</error-page>
</web-app>
This code works fine with all the other web browsers (opera 8.0, mozilla, netscape 6.0) and displays "error.html", since the "myjsp.jsp" page is not found. It does not work with Internet explorer 6.0 and displays the default Internet Explorer page with error 404. I have check for the proxy setting, disabled 3rd party browser extensions and checked for other setting, but it still does not work. Please help.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Under "Tools -> Options -> Advanced", look for "Disable Friendly HTTP Error Messages".
 
ruhul islam
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code started working with IE 6.0, when I disabled "Show friendly HTTP error messages" from "advance settigs" of IE.
But this solution is not acceptable as we cannot suggest our user to change these settings before using our application.
Is there any other solution ??? Please Help ???
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code started working with IE 6.0


The code itself always works. What IE does with the information sent to it is completely under control of the browser and there's not a thing you can do about it except set the browser to not show its own error displays.
 
ruhul islam
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Ben and thank you Bear for the suggestions.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't tried it so this is just a rough idea (mostly thinking out loud).

If your error pages were to send a 200 response code, the browser wouldn't know that it was showing an error message.

Not sure what this would involve other than to say that you must set any headers before writing output so this would need to be done at the very top of your JSP.

Look at response.setHeader(...

http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletResponse.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!