Nope, it is from a class we wrote for errorhandling neatly formatted as a
string.  This method is inspired by the cos (com.oreilly.servlet) package.

package is.degree.dw3;

import is.degree.dw3.DwString;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;

 public class ErrorHandling {
    public static String getHtmlStackTrace(Throwable e) {
        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
        PrintWriter writer = new PrintWriter(bytes, true);
        e.printStackTrace(writer);
        String stack = bytes.toString();
        stack = DwString.replaceStr( stack, "\n", "<BR>\n &nbsp;" );
        stack = "<HR>" + stack + "<HR>";
        return stack;
    }
}



----- Original Message -----
From: John Hardin <[EMAIL PROTECTED]>
To: 'Magnús Þór Torfason ' <[EMAIL PROTECTED]>
Sent: Friday, October 08, 1999 8:24 PM
Subject: RE: JSP debugging


Thanks for the info.

Is is.degree.getHtmlStackTrace (referenced below) something specific to
JRun?  As I said previously, I'm using Netscape's NAS.

TIA.


-----Original Message-----
From: Magnús Þór Torfason
To: John Hardin
Sent: 10/8/99 11:54 AM
Subject: RE: JSP debugging

JRun creates a stack trace for all syntax errors that occur while it is
compiling and outputs it as a web page.  In most cases, it also outputs
runtime exceptions.

For runtime exceptions however,  we have found this code particularly
useful:


** Beginning of JSP Page.
<% try { %>

All the JSP code comes here

<%
    } catch (Exception e) {
        out.println( is.degree.getHtmlStackTrace(request, e) );
    }
%>
** end of JSP Page.


the function extracts the stack trace from the exception and outputs it
in a
readable format onscreen, this also stops the exception from propagating
to
the server, causing a 500 Internal Server Error.

The only drawback is that this method gives the line number of the JAVA
file, not the JSP file, so we have to find the line in the java file,
see
what the matter is, and then edit the JSP file.

Magnus Torfason



> -----Original Message-----
> From: A mailing list about Java Server Pages specification and
reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of John Hardin
> Sent: 8. október 1999 14:37
> To: [EMAIL PROTECTED]
> Subject: JSP debugging
>
>
> We're considering moving some number of ASP pages into JSP.  However,
my
> initial experience with JSPs (via Netscape NAS) shows the
> development/debugging environment to be particularly lacking.
> Are there any
> JSP environments that provide a least Server debugging messages
similar to
> that provided by IIS with ASP (e.g., indicating the particular line
(and
> sometimes the particular *character*) that caused the error)?
(Developing
> pages by inserting various calls to out.println or
> System.out.println isn't
> my idea of cutting-edge development.  :-)
>
> Perhaps its my use of JSP that's preventing the Server from doing its
job,
> but I'm not quite sure what it is that I should (or should *not*)
> be doing.
>
> I'm a *huge* fan of the concept of JSP, but at this stage the
realization
> seems like a real step backwards in terms of the ability with
> which we'll be
> able to develop/debug JSPs.
>
> Thanks in advance for any/all help.
>
> -John Hardin
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to