• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

error-code using jsp

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello friends,

I have configured an error page to handle 500 error.
Webserver used: Tomcat 5

In DD of my application I have made the following entry

<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>

Following is the jsp page which generates the error.
<%
Boolean flag = false;
if( !flag )
{
response.sendError(500, "Access forbidden boss");
}
%>


Following is the error.jsp
<%@ page isErrorPage="true" %>
Error = <font color="Red" size="8"><%=exception.getMessage()%></font>

By doing the above settings I am unable to see the custom error page. What I see is the default error page which tomcat generates.
I am able to see the custom error page for <exception-type> tag in DD.

Can anyone please help where I am going wrong ?
Few of the members suggested that in IE please uncheck "Show friendly HTTP error messages" in Advanced tab in tools-->Options. Few others suggested that the contents should be more than 5KB. If the custom error page contents are less than 5KB then default error page is shown.

I tried all of the above things but I am unable to see the custom error page for <error-code>

Please help..
Waiting for your replies.

Thanks and Regards
Rohit.
[ May 09, 2007: Message edited by: Rohit Bhagwat ]
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

default error page which tomcat generates.


Can you show us that error message ?
 
Rohit Bhagwat
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Satou kurinosuke:

Can you show us that error message ?



HTTP Status 500 - Access forbidden boss

---------------------------------------------------------------------------

type Status report

message Access forbidden boss

description The server encountered an internal error (Access forbidden boss) that prevented it from fulfilling this request.
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What else were you expecting?
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried it in other browsers?
 
Rohit Bhagwat
Ranch Hand
Posts: 205
  • 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:
What else were you expecting?



I was expecting custom error page to be displayed rather than tomcat generated error page [shown above].

I have not yet tried with other browsers, might need to try for that.
But still I am wondering what can be the problem?

Thanks
Rohit.
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rohit Bhagwat:

I have not yet tried with other browsers, might need to try for that.
But still I am wondering what can be the problem?



Trying it in other broswers is one of the steps to try and figure that out. Stop wondering and start testing.
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rohit,
Do you have the following line in your following jsp page?

<%@ page errorPage="error.jsp" %>

<%
Boolean flag = false;
if( !flag )
{
response.sendError(500, "Access forbidden boss");
}
%>
 
Rohit Bhagwat
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Suman Sharma:
Rohit,
Do you have the following line in your following jsp page?



I dont know what difference it will make whether it is present or not ? The problem is I am not getting redirect to error.jsp. So either it is configured in web.xml or it is declared in page directive tag. Doesnt make a difference.

The reason I have not yet tried with other browser is my client will be mostly using IE.

Thanks
Rohit.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the exact version of Tomcat ?
I have 5.5, and tried it on both Firefox and IE. It worked.
 
Rohit Bhagwat
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Satou kurinosuke:
What is the exact version of Tomcat ?
I have 5.5, and tried it on both Firefox and IE. It worked.



Tomcat: 5.0
IE : 6.0
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rohit Bhagwat:

The reason I have not yet tried with other browser is my client will be mostly using IE.



Did you stop to think that by trying it in another browser that it would help determine if the issue is with IE -- which is known to have bugs related to error pages -- or if the issue is with your code?

Try it in Firefox now.
 
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic