Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error Page problem?

 
Weston Kornfeld
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to use the jsp error page mechanism to better handle when exceptions are thrown.

I believe I have things set up correctly, but when an exception is thrown in my web app my error page does not show up -- just a printout of the actual exception(i.e. as if the error page was not set up at all).

My set up is:

I have an error page: genericError.jsp

I am referencing that is a .jsp that can throw an exception as
<%@ page errorPage="genericError.jsp"%>

genericError.jsp is in the same directory as the page that might throw an exception so I don't think I need to fully qualify it.

Any ideas what the problem is? I am running weblogic.

Many Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so I don't think I need to fully qualify it.


You don't, but I always do anyways. This eliminates any unintended coupling between the pages based upon location.

but when an exception is thrown in my web app my error page does not show up


Anywhere in the web app? The on-page declaration will only affect exceptions thrown within the JSP in which the declaration is made.

If you want a more general mechanism (which I recommend), declare the error handling in the web.xml file.
 
Weston Kornfeld
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is within the .jsp.

Also, I am using struts but I wound't think that should make any difference.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, and genericError.jsp is declared as an error page?
 
Weston Kornfeld
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say:

genericError.jsp is declared as an error page?

What do you mean?

The only thing I am doing is specifying it in my .jsp at the top of the .jsp file that could throw an error i.e.:

<%@page errorPage="genericError.jsp" %>
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
Weston Kornfeld
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I have that in the actual error page itself.
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if this is related to your problem. But, some versions of IE display their own friendly error page by default. Somewhere in your internet options you need to uncheck that checkbox that says "display friendly error messages or so..."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic