Shoot. Didn't read your message closely enough. This only applies to
exceptions thrown within a JSP page and handled by the JSP exception
handling mechanism, and you're talking about the Struts exception
handling mechanism.
Sorry 'bout the noise.
-- Jeff
Jeff Beal wrote:
From Section 2.4 of the JSP 1.2 specification:
"If the errorPage attribute of a page directive names a URL that refers
to another JSP, and that JSP indicates that it is an error page (by
setting the page directive’s isErrorPage attribute to true) then the
'exception' implicit scripting language variable of that page is
initialized to the offending Throwable reference"
-- Jeff
Daffin, Miles (Company IT) wrote:
JC,
Thanks. This I know. But...
If I do this in struts-config:
<global-exceptions>
<exception
key="exception.general"
type="java.lang.Exception"
path="/error.jsp"/>
</global-exceptions>
Then error.jsp will be called when an Exception is thrown by an Action
method. In error.jsp I can print a general message. I would like to be
able to also print out stack trace info in the jsp. Does the mere fact
of designating error.jsp as my error hadling page mean that struts has
put the Exception somewhere, e.g. the request? If so under what key? Or
must I do all this myself:
<global-exceptions>
<exception
key="exception.general"
type="java.lang.Exception"
path="/error.do"
handler="com.plok.blah.ExeptionHandler" />
</global-exceptions>
In ExeptionHandler I log the problem ad then put the formatted Exeption
stacktrace on the request, or something similar?
-Miles
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent:
11 January 2005 16:20
To: Struts Users Mailing List
Subject: RE: Handling the exceptions in struts
Miles, you can capture a stack trace from any throwable using a
technique
like:
ByteArrayOutputStream baos = new
ByteArrayOutputStream();
(new Throwable(s)).printStackTrace(new
PrintStream(baos));
return baos.toString();
The result could be logged.
Hope this helps.
JC
"Daffin, Miles
(Company IT)" To: "Struts
Users Mailing List" <user@struts.apache.org>
<[EMAIL PROTECTED] cc:
tanley.com> Subject: RE:
Handling the exceptions in struts
01/11/2005 05:54 AM
Please respond to
"Struts Users Mailing
List"
The html:errors tag will display a generic message but how can I
display the details of what went wrong (e.g. the Exception's
stacktrace) in the designated error jsp?
What are the options?
Can someone point me at some docs that go into this in more detail?
Thanks,
-Miles
**********
The information contained in this communication is confidential,
private, proprietary, or otherwise privileged and is intended only
for the use of the addressee. Unauthorized use, disclosure,
distribution or copying is strictly prohibited and may be unlawful.
If you have received this communication in error, please notify the
sender immediately at (312)653-6000 in Illinois; (972)766-6900 in
Texas; or (800)835-8699 in New Mexico.
**********
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender.
Sender does not waive confidentiality or privilege, and use is
prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]