org.apache.struts.action.ExceptionHandler by default puts the exception in the request;
request.setAttribute(Globals.EXCEPTION_KEY, ex); So, if you have a custom ExceptionHandler, just make sure you call super.execute() so that setting of the exception is done for you. (or You have to set it in the request explicitly). In the error.jsp you can retrieve that execption from the request. On Tue, 11 Jan 2005 16:36:29 -0000, Daffin, Miles (Company IT) <[EMAIL PROTECTED]> 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]