Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 32156 invoked from network); 3 Feb 2003 19:35:26 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 3 Feb 2003 19:35:26 -0000 Received: (qmail 84 invoked by uid 97); 3 Feb 2003 19:36:57 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 75 invoked from network); 3 Feb 2003 19:36:56 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 3 Feb 2003 19:36:56 -0000 Received: (qmail 27235 invoked by uid 500); 3 Feb 2003 19:34:24 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 27189 invoked from network); 3 Feb 2003 19:34:23 -0000 Received: from unknown (HELO wilson.dc.Blackboard.com) (64.124.103.135) by daedalus.apache.org with SMTP; 3 Feb 2003 19:34:23 -0000 Received: from madison.dc.Blackboard.com ([10.8.0.112]) by wilson.dc.Blackboard.com with Microsoft SMTPSVC(5.0.2195.3779); Mon, 3 Feb 2003 14:34:23 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: RE: Custom tag life cycle Date: Mon, 3 Feb 2003 14:34:22 -0500 Message-ID: <66337F04F2A1E440BF87F2080B5F537001481DED@madison.dc.Blackboard.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Custom tag life cycle Thread-Index: AcLLswWYoOoiwp3iRIGSYRyu/LZ5BQAB2eaQ From: "Tim Moore" To: "Tomcat Users List" X-OriginalArrivalTime: 03 Feb 2003 19:34:23.0052 (UTC) FILETIME=[410D78C0:01C2CBBB] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N > -----Original Message----- > From: Will Hartung [mailto:willh@msoft.com]=20 > Sent: Monday, February 03, 2003 1:38 PM > To: Tomcat Users List > Subject: Re: Custom tag life cycle >=20 >=20 > > From: "Tim Moore" > > Sent: Monday, February 03, 2003 9:30 AM > > Subject: RE: Custom tag life cycle >=20 >=20 > > But I would do the initialization in doStartTag rather than=20 > doEndTag.=20 > > The latter may not be called if an exception is thrown from=20 > within the=20 > > tag body. >=20 > The problem here is that the doStartTag is done after all of=20 > the properties are set. >=20 > So, you don't know if a property value has been set from the=20 > current tag invocation or an earlier tag invocation. >=20 > I think Felipes idea of using the doFinally as a "reset to=20 > default contructed state" is the smartest thing. I'd like to=20 > hope that the new JSP spec clarifies the lifecycle a bit=20 > better, taking in to account the aggressive caching that the=20 > containers are doing now. But did you see the rest of my message? It's important to not actually reset the instance variables between invocations. So really, you don't want to intialize those at all, but invocation-specific local variables. More from the JSP 1.2 spec: s.10.1: "It is the responsability of user code, be it scriptlets, JavaBeans code, or code inside custom tags, to not invoke these setter methods, as doing otherwise would interfere with the container knowledge." "Once properly set, all properties are expected to be persistent, so that if the JSP container ascertains that a property has already been set on a given tag handler instance, it needs not set it again." s.10.1.1 : "After the doEndTag invocation, the tag handler is available for further invocations (and it is expected to have retained its properties)." So I misstated; you don't want to initialize properties themselves in doStartTag, you want to do something like this: String attr1 =3D this.attr1; if (attr1 =3D=3D null) { attr1 =3D DEFAULT_ATTR1; } etc. --=20 Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org