RE: Tomcat error-page not working (was: RE: Tomcat and checked vs. unchecked exceptions)

2004-03-16 Thread Wendy Smoak
A while ago, Yoav Shapira wrote:
 I asked if it's the nice IE error pages or the actual tomcat ones.  
 There's an IE setting in Internet Options along the lines of 
 Display Friendly Error Pages that can mask the server's error pages
 if enabled, and it's enabled by default on some platforms.

I finally got a chance to work on this again, and this is exactly the
problem.  Which makes my lovely error pages fairly useless since I can't
go around to everyone's computer and make sure they've unchecked the
box.

So... From a plain-old Servlet, when, for example, I'm retrieving text
from a database and trying to create a PDF, and there is no text, how do
I show a nice error page?

It's been a LONG time since I've done a regular Servlet.  Am I trying to
apply some Struts-type global forward idea here without realizing it?
Or is this supposed to work, except that in this case IE is helpfully
refusing to show my page?

What I'm currently doing:
[in PDFServlet.java]
throw new ServletException( No data found in HOLD file );

[in web.xml]
error-page
   exception-typejavax.servlet.ServletException/exception-type
   location/error.jsp/location
/error-page

Should I instead be doing something with RequestDispatcher and
forwarding to this JSP to avoid the status being set to 500 and
confusing IE?

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat error-page not working (was: RE: Tomcat and checked vs.

2004-03-16 Thread Michael Davis
Hi,

This is really easy with jsp. I'm doing something similar. I don't have the code here, 
but
it goes something like:

in servlet.java:

HttpRequest req; // this is passed to you
HttpSession sess = req.getSession();
sess.setAttribute( errorMessage, Something terrible has happened. );

And I have this code in a file called header.jsp, which is included by other pages.
It uses the Standard Tag Library:
jsp:useBean id=errorMessage scope=session class=java.jang.String/

c:if test=${errorMessage.length == 0}
c:out value=${errorMessage}/
/c:if

Good luck,
Michael
Toronto

On Mar 16, Wendy Smoak [EMAIL PROTECTED] wrote:
 
 So... From a plain-old Servlet, when, for example, I'm retrieving text
 from a database and trying to create a PDF, and there is no text, how do
 I show a nice error page?
 
 It's been a LONG time since I've done a regular Servlet.  Am I trying to
 apply some Struts-type global forward idea here without realizing it?
 Or is this supposed to work, except that in this case IE is helpfully
 refusing to show my page?
 
 What I'm currently doing:
 [in PDFServlet.java]
 throw new ServletException( No data found in HOLD file );
 
 [in web.xml]
 error-page
exception-typejavax.servlet.ServletException/exception-type
location/error.jsp/location
 /error-page
 
 Should I instead be doing something with RequestDispatcher and
 forwarding to this JSP to avoid the status being set to 500 and
 confusing IE?
 
 -- 
 Wendy Smoak
 Application Systems Analyst, Sr.
 ASU IA Information Resources Management 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat error-page not working (was: RE: Tomcat and checked vs. unchecked exceptions)

2004-02-26 Thread Shapira, Yoav

Howdy,

Yoav, this is Tomcat-only, on my development box, so no Apache error
pages.

Great, but that's not what I asked ;)  I asked if it's the nice IE
error pages or the actual tomcat ones.  There's an IE setting in
Internet Options along the lines of Display Friendly Error Pages that
can mask the server's error pages if enabled, and it's enabled by
default on some platforms.

I'm going to make a test webapp and a Servlet that throws various
exceptions, to see if I can narrow this down.  Obviously it's something
I'm doing wrong, nobody else is having this problem.

Yup, good approach.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat error-page not working (was: RE: Tomcat and checked vs. unchecked exceptions)

2004-02-25 Thread Shapira, Yoav

Howdy,

   error-page
  exception-typejavax.servlet.ServletException/exception-type
  location/WEB-INF/jsp/exceptions/ServletException.jsp/location
   /error-page

(in the appropriate place, at the bottom just above /web-app)

When this code executes:
   if ( report == null || report.equals(  ) ) {
  log.debug( doGet: no data!  Need to forward to an error page.
);
  throw new ServletException( No data found in HOLD file );
   }

I _still_ get this in the browser:

type Exception report
message
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
javax.servlet.ServletException: No data found in HOLD file
   at edu.asu.vpia.webapp.PDFServlet.doGet(PDFServlet.java:94)

Hmm.  Does the error page say Tomcat on it, or is it the IE error page?
I guess the former, but still need to ask.  Was the root cause that you
chopped off the above stack trace also a ServletException, or something
else?

Yansheng Lin suggested using Struts declarative exception handling, but
this is a plain-old Servlet, not a Struts Action.

Yeah, that suggestion wasn't relevant.

What am I missing, why do I get a Tomcat-generated error page and not
the JSP I specified?

Are you sure you're not catching the exception somewhere in your webapp
and rethrowing it at something else?

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat error-page not working (was: RE: Tomcat and checked vs. unchecked exceptions)

2004-02-25 Thread Evgeny Gesin
This is JSP rather than Tomcat question, but I hope
for a reply.

I have a JSP with the following jsp:plugin code:

jsp:plugin type=applet
code=com.package.Applet.class
codebase=/application1/applets/ width=50
height=50
/jsp:plugin

Web applications, which run this applet, specify
different codebase attribute, such as application2,
application3 and so on.

Unfortunatelly JSP specification doesn't allow dynamic
codebase in jsp:plugin and we create a new JSP for
each new web domain to specify another hardcoded
codebase attribute.

Could you please advice a trick to generate codebase
attribute at run-time, to deploy the same JSP in all
applications.

Evgeny Gesin
Javadesk

__
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat error-page not working (was: RE: Tomcat and checked vs. unchecked exceptions)

2004-02-25 Thread Jerry Ford
Wendy:

Here's your problem:

  location/WEB-INF/jsp/exceptions/ServletException.jsp/location

JSPs can't be run from inside the WEB-INF directory. Try moving your 
jsp/exceptions directory up one level.

Jerry

Wendy Smoak wrote:

From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
Try exception-typejava.lang.RuntimeException/exception-type, as
that's the superclass for unchecked exceptions and you 
probably want to
handle them all the same (if you want to handle them at all, which
apparently you do).
   

I don't understand. :(  I don't know if this is related to the original
question, but I have this in web.xml:
  error-page
 exception-typejavax.servlet.ServletException/exception-type
 location/WEB-INF/jsp/exceptions/ServletException.jsp/location
  /error-page
(in the appropriate place, at the bottom just above /web-app)

When this code executes:
  if ( report == null || report.equals(  ) ) {
 log.debug( doGet: no data!  Need to forward to an error page. );
 throw new ServletException( No data found in HOLD file );
  }
I _still_ get this in the browser:

type Exception report
message 
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception 
javax.servlet.ServletException: No data found in HOLD file
	at edu.asu.vpia.webapp.PDFServlet.doGet(PDFServlet.java:94)

Yansheng Lin suggested using Struts declarative exception handling, but
this is a plain-old Servlet, not a Struts Action.
The same error-page tag works fine in a different webapp, I'm at a
loss as to why it fails in this one.  The JSP is present in the location
given in the tag.
What am I missing, why do I get a Tomcat-generated error page and not
the JSP I specified?
 





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Tomcat error-page not working (was: RE: Tomcat and checked vs. unchecked exceptions)

2004-02-25 Thread Wendy Smoak
 From: Jerry Ford [mailto:[EMAIL PROTECTED] 
 Wendy:
 Here's your problem:
 location/WEB-INF/jsp/exceptions/ServletException.jsp/location
 JSPs can't be run from inside the WEB-INF directory. Try moving your 
 jsp/exceptions directory up one level.

All of my JSP's are under WEB-INF, and they work fine.  (I don't allow
direct access to JSP's, everything goes through Struts/Tiles.)  In fact
that same location tag works fine in another webapp (which makes me
think that there's some config problem in this one.)

Yoav, this is Tomcat-only, on my development box, so no Apache error
pages.

I'm going to make a test webapp and a Servlet that throws various
exceptions, to see if I can narrow this down.  Obviously it's something
I'm doing wrong, nobody else is having this problem.

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]