yeah i�d love to. unfortunately i'm doing this jsp-stuff as a first
approach to jsp in my company so we don�t have the appropriate ide... we
got jbuilder3 - not capable of jsp so i recently rely on notepad(!).
so: if anyone has some experiences with this topic or can show me a better
way of error-handling in this context i�d be very grateful.
have a nice weekend, folks!
steffen
"M. Simms"
<prosys@bellatl An:
<[EMAIL PROTECTED]>
antic.net> Kopie:
Thema: FW: problem with catching
exceptions from
26.04.2001 tags on the errorPage
16:59
Bitte antworten
an prosys
Best to apply a JSP source code debugger like Jbuilder4 for this one.....it
sounds hairy.
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]] On Behalf Of Steffen Morawietz
Sent: Thursday, April 26, 2001 8:18 AM
To: [EMAIL PROTECTED]
Subject: problem with catching exceptions from tags on the errorPage
hi folks.
i�m using my own taglib for generating dynamic tables. i�m also using the
errorPage-directive on all my pages (works fine).
the tags do all call a method getContent() in their doStartTag-method which
is used to build the html-content-string so when an error (e.g.
database-access) occurs in getContent() it throws a simple exception (incl.
message) which is caught in the doStartTag()-method. in this case i raise a
javax.servlet.jsp.JspTagException with the same message hoping it to be
registered on the page the tags are included in and then of course handled
by my error-page.
public int doStartTag()
throws javax.servlet.jsp.JspTagException {
...
try {
getContent();
} catch (Exception e) {
throw new javax.servlet.jsp.JspTagException(e.getMessage());
}
return SKIP_BODY;
}
the error-page looks like this:
<%@ page import="java.io.*,java.util.*" isErrorPage="true" %>
<html>
<head>
<title>Error</title>
</head>
<body>
Exception: <%= exception %><br>
<br>
Exception-Message:<br>
<jsp:scriptlet>
ByteArrayOutputStream ostr = new ByteArrayOutputStream();
exception.printStackTrace(new PrintStream(ostr));
out.print(ostr);
</jsp:scriptlet>
</body>
</html>
astonishingly the the 3rd page (which contains the tags) outputs all
content until the exception occurred and then just appends the output of
the error page like this:
<html>
// normal output until exception occurs goes here...
...
// the tag is called HERE
<html>
<head>
<title>Error</title>
</head>
<body>
Exception: <br>
<br>
Exception-Message:<br>
why isn�t the exception forwarded to the error-page but the error-page
included in the other page instead?
thanx 4 your help in advance!
greetings
steffen
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets