I would like to have an error page that handles exceptions that flows the
site I'm developing.  In order to do this I would like to replace the Tomcat
generated page with a jsp:

 

<error-page>

<exception-type>java.lang.Throwable</exception-type>

<location>/jsp/error.jsp</location>

</error-page>

 

Then in the error.jsp have a line like : 

 

<c:out value="${pageContext.exception.stacktrace}" />

 

However nothing prints.  If I modify the jsp containing the preceding c:out
to contain an error, then the Tomcat Error page takes over and shows a
stacktrace.  So I know one is available, I just need to know how to access
it!  Anyone know what I’m doing wrong?

 

Thanks,

 

jb

-----Original Message----- 
From: Michael Duffy [mailto:[EMAIL PROTECTED] 
Sent: Wed 6/18/2003 7:47 AM 
To: Tag Libraries Users List; Jim Kennedy 
Cc: 
Subject: Re: Exception var - how to get using JSTL




        Yes, 'javax.servlet.jsp.jspException' is the parameter 
        name that's used when the exception value is set. 
        It's important to know, because if you do MVC-2 with 
        your own front controller servlet you've got to set 
        that parameter inside the servlet whenever an 
        exception is thrown.  If you don't, the JSP error page 
        won't find it. 

        Buy Shawn Bayern's "JSTL In Action" book by Manning. 
        What you wanted was right there on page 267.  Lots of 
        other good stuff, too. 

        Anytime I'm faced with a new technology I like to have 
        a good book at my elbow.  When I started with JSTL, 
        this was the only book I bought. 

        --- Jim Kennedy <[EMAIL PROTECTED]> wrote: 
        > This also works: 
        > <c:set var="error" 
        > 
        value="${requestScope['javax.servlet.jsp.jspException']}" 
        > /> (for Tomcat) 
        > 
        > but I wanted to avoid the "javax.servlet.jsp..." 
        > stuff. 
        > 
        > Your method is what I was looking for.  I have not 
        > read anything that lead 
        > me to "exception" being the name of that property. 
        > Is there a table that 
        > shows all available pageContext properties.  It's 
        > definitely logical though 
        > since exception is an implicit variable for JSP 
        > pages.  However, that 
        > pattern breaks down for: 
        > 
        > pageContext.servletConfig  which is "config" in JSP 
        > pages 
        > 
        > and 
        > 
        > pageContext.servletContext which is "application" in 
        > JSP pages. 
        > 
        > Can you tell me how you came by this info for 
        > "exception". 
        > 
        > 
        > 
        > thanks 
        > 
        > 
        > Jim Kennedy 
        > IT Consultant 
        > Mobile Phone: 813-503-1484 
        > 
        ----------------------------------------------------- 
        > 
        > 
        > 
        > ----- Original Message ----- 
        > From: "Michael Duffy" <[EMAIL PROTECTED]> 
        > To: "Tag Libraries Users List" 
        > <[EMAIL PROTECTED]>; "Jim 
        > Kennedy" <[EMAIL PROTECTED]> 
        > Sent: Tuesday, June 17, 2003 4:39 PM 
        > Subject: Re: Exception var - how to get using JSTL 
        > 
        > 
        > > 
        > > Wouldn't you use 
        > > 
        > > <c:out value="${pageContext.exception.message}"/>? 
        > > 
        > > That's just straight JSTL, so it should be okay. - 
        > MOD 
        > > 
        > > 
        > > 
        > > --- Jim Kennedy <[EMAIL PROTECTED]> wrote: 
        > > > Can someone help me with the technique to grap 
        > the 
        > > > exception (implicit) 
        > > > variable that exists when isErrorPage=true.  I 
        > know 
        > > > it will be part of the 
        > > > pageScope JSTL variable, but I need a technique 
        > NOT 
        > > > specific to a container. 
        > > > 
        > > > I don't want to use <% %> at all.  I need an 
        > only 
        > > > tag technique. 
        > > > 
        > > > Currently there is not ${exception} guy. 
        > > > 
        > > > Thanks 
        > > > 
        > > > 
        > > > 
        > > 
        > 
        ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: 
        > > > [EMAIL PROTECTED] 
        > > > For additional commands, e-mail: 
        > > > [EMAIL PROTECTED] 
        > > > 
        > > 
        > > 
        > > __________________________________ 
        > > Do you Yahoo!? 
        > > SBC Yahoo! DSL - Now only $29.95 per month! 
        > > http://sbc.yahoo.com 
        > > 
        > > 
        > 
        ---------------------------------------------------------------------
> > 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] 
        > 


        __________________________________ 
        Do you Yahoo!? 
        SBC Yahoo! DSL - Now only $29.95 per month! 
        http://sbc.yahoo.com 

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

Reply via email to