> -----Original Message-----
> From: Felipe Schnack [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, February 03, 2003 3:56 PM
> To: Tomcat Users List
> Subject: RE: more about custam tag life cycle
> 
> 
> > >   Yes, but it can be done... to me seems simpler to change
> > > the spec a little than add even more methods (this tends to 
> > > create even more confusion IMHO)
> > But, to reiterate, there isn't really any kind of useful "cleaning" 
> > you can do in doFinally that doesn't break the spec in other ways.
>   Why? Because doFinally() is meant to be called to handle 
> exceptions? Well, for this exact reason that we can be sure 
> that it's called every time after doEndTag()...

I guess it depends on what kind of cleaning you're doing.  If you're
doing something like releasing a database connection, then that's OK.
If you're resetting attribute values, the tag can't be reused correctly.


> > > > >   Tag reusing is so rare to be useful at all? Why?
> > > > Well I guess that's the conclusion they came to by JSP 2.0, and 
> > > > the
> > > > rationale behind the SimpleTag interface.
> > >   Yes, but I guess it must be hard to know when is good to
> > > pool a tag, 
> > > isn't it? :-)
> > Only when there is some kind of expensive operation necessary that 
> > could be done once rather than per-invocation.  For example 
> if you had 
> > a tag that read a large configuration file that isn't expected to 
> > change while the appserver is running, you obviously don't 
> want to do 
> > that every time the tag is called.  But for most simple 
> tags, nothing 
> > like that is necessary.
>   So it's an accepted statement that tag reuse, implemented 
> in Tomcat 4.1.x, isn't very useful in most cases?

Well, I don't know about accepted.  Some people back on tomcat-dev were
saying that tag pooling drastically improved performance in pages with
lots of tags in Tomcat 4.1.  But at the very least, JSP 2.0 will allow
you to make the choice between simplicity and reusability on a
per-taghandler basis.

> 
> > >   My conclusion about my experience and all this debate is
> > > that I should always initialize tag attributes with null, and 
> > > reset them in doFinally()...
> > You should reset them to null in release, and not change 
> them at all 
> > anywhere else (except for the setters, of course).
>   Hm... so this is standard behavior? release() is called after
> doEndTag() in all containers that use pooling?

I'd think it would have to.  In any case, the spec guarantees that the
attributes will be stable *until* release is called, and that the
instance will not be reused for an invocation with a different set of
attributes defined.
-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to