Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 55549 invoked from network); 3 Feb 2006 03:55:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Feb 2006 03:55:44 -0000 Received: (qmail 85825 invoked by uid 500); 3 Feb 2006 03:55:28 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 85074 invoked by uid 500); 3 Feb 2006 03:55:26 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 85049 invoked by uid 99); 3 Feb 2006 03:55:26 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Feb 2006 19:55:26 -0800 X-ASF-Spam-Status: No, hits=1.9 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of grm7790@verizon.net designates 206.46.252.46 as permitted sender) Received: from [206.46.252.46] (HELO vms046pub.verizon.net) (206.46.252.46) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Feb 2006 19:55:25 -0800 Received: from [127.0.0.1] ([70.18.230.49]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IU3003TUEVRJJ12@vms046.mailsrvcs.net> for users@tomcat.apache.org; Thu, 02 Feb 2006 21:55:04 -0600 (CST) Date: Thu, 02 Feb 2006 22:57:27 -0500 From: Glen Mazza Subject: Re: Best practice for Capturing JSP Errors In-reply-to: <43E26D41.5080509@acadaca.com> To: Tomcat Users List Message-id: <43E2D4A7.7050205@verizon.net> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit X-Accept-Language: es-es, es X-Antivirus: avast! (VPS 0605-4, 02/01/2006), Outbound message X-Antivirus-Status: Clean References: <43E26D41.5080509@acadaca.com> User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Mott Leroy wrote: > I am on Tomcat 5.0.x > > I am familiar with a couple ways to capture errors that occur on the JSP > side. One way is to use the error page tag: > > <%@ page errorPage="MyErrorPage.jsp" %> > Chapter 10 on exception handling, Beginning JavaServer Pages (Wrox Books, 2005), I think would be helpful for you here. I think (am unsure) you can make your error page the same as the page that created the error (by adding another page directive <%@page isErrorPage="true" %> to the same page). This way, by checking if the ${pagecontext.exception} property is populated (indicating that this page was activated *not* as a non-exception first activation but as an exception-based second or third activation), you can then add error messages to the JSP page. > And another is to define the error page in your web.xml: > > > 500 > /myPage.jsp > > I would save these for generic HTTP error codes, or generic Java exceptions (NullPointerErrors, ClassCastExceptions, perhaps), things are more likely the result of errors in coding than in user entry, and something the user cannot really recover from. Also, the JSTL action may be something to look at here, to keep runtime/coding errors handled within the JSP pages, without needing to forward to a generic error page. Glen --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org