You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by Martin van Dijken <mv...@madocke.nl> on 2003/10/10 10:07:31 UTC

Cleanup

Hey gang,

I was reading through an IO tag to uproot a problem I had. I noticed that the tag does all the cleanup in release(), while I was under the assumption that this should always be done in doEndTag() because pooling containers don't call release everytime. Can somebody update me on what the final word on that is?

Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


Re: Cleanup

Posted by Glenn Nielsen <gl...@mail.more.net>.
Some of the taglibs here are fairly old and will not work in JSP engines which implement
custom tag pooling.

Here is some information on tag life cycle management:

http://jakarta.apache.org/taglibs/guidelines.html

Regards,

Glenn

Martin van Dijken wrote:
> Hey gang,
> 
> I was reading through an IO tag to uproot a problem I had. I noticed that the tag does all the cleanup in release(),
> while I was under the assumption that this should always be done in doEndTag() because pooling containers don't call
> release everytime. Can somebody update me on what the final word on that is?
> 
> Martin
> 
> --------------------------------------------------------------------- To unsubscribe, e-mail:
> taglibs-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


Re: Cleanup

Posted by Vit Timchishin <ti...@gtech-ua.com>.
On Fri, 10 Oct 2003 09:15:49 -0700, Craig R. McClanahan wrote:

>Abey Mullassery wrote:
>
>>I was also trying to find out where to put clean up code. Here is the bit I
>>had found.
>>
>>>>From the JSP 2.0 specification: "The JSP container may reuse classic tag
>>handler instances for multiple occurrences of the corresponding custom
>>action, in the same page or in different pages, but only if the same set of
>>attributes are used for all occurrences."
>>  
>>
>
>It's very important to note that the test is on the same set of 
>*attributes*, not the same set of *values*.
>
>>If the "SAME set of attributes" are used, the properties will be overwritten
>>even if it is not initialized. But if there are other variables which are
>>initialized only once in the constructor or so based on the first set of
>>values it might be a problem.
>>  
>>
>
>Consider a tag that has three attributes (foo, bar, and baz), used in a 
>page like this:
>
>  <tags:mytag foo="a" bar="b"/>
>  <tags:mytag foo="a" bar="c"/>
>
>Can the tag instance for the first occurrence be reused for the second?  
>The answer is yes, because it is the same set of attributes are 
>selected.  However, the container is free to notice that the value for 
>"foo" was the same in both cases, and only call setBar() the second time.

Hello. 

And what about body? Is it considered an attribute?
I am still having open bug in tomcat because of "old body" problems: 
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16830

Look at two calls: <c:out value="">Default</c:out> <c:out value=""/>. You will have second c:out output 
"Default" because of tag reuse and pooling without looking at body support.

P.S. Is it correct place for feature requests for JSTL?

С уважением,
Виталий Валериевич Тимчишин,
руководитель отдела ASL
ООО "Голден Технолоджис"
http://www.gtech-ua.com




---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


Re: Cleanup

Posted by "Craig R. McClanahan" <cr...@apache.org>.
Abey Mullassery wrote:

>I was also trying to find out where to put clean up code. Here is the bit I
>had found.
>
>>>From the JSP 2.0 specification: "The JSP container may reuse classic tag
>handler instances for multiple occurrences of the corresponding custom
>action, in the same page or in different pages, but only if the same set of
>attributes are used for all occurrences."
>  
>

It's very important to note that the test is on the same set of 
*attributes*, not the same set of *values*.

>If the "SAME set of attributes" are used, the properties will be overwritten
>even if it is not initialized. But if there are other variables which are
>initialized only once in the constructor or so based on the first set of
>values it might be a problem.
>  
>

Consider a tag that has three attributes (foo, bar, and baz), used in a 
page like this:

  <tags:mytag foo="a" bar="b"/>
  <tags:mytag foo="a" bar="c"/>

Can the tag instance for the first occurrence be reused for the second?  
The answer is yes, because it is the same set of attributes are 
selected.  However, the container is free to notice that the value for 
"foo" was the same in both cases, and only call setBar() the second time.

The upshot is that your tag implementation class should *never* modify 
the values that were configured by the page, from the beginning of 
doStartTag() through the end of doEndTag().  It's legal to clean up in 
release(), however.

>Either way I thought it was safer to put all clean up in doEndTag() itself.
>However I wanted to look into the JSP spec once more.
>

You'll find that release() is a better place for that.

>Regards,
>
>Abey Mullassery
>W: http://www.mullassery.com
>==============================
>  
>
Craig

>  
>
>>-----Original Message-----
>>From: Martin van Dijken [mailto:mvdijken@madocke.nl]
>>Sent: Friday, October 10, 2003 1:38 PM
>>To: Taglib Developers (E-mail)
>>Subject: Cleanup
>>
>>
>>Hey gang,
>>
>>I was reading through an IO tag to uproot a problem I had. I
>>noticed that the tag does all the cleanup in release(), while I
>>was under the assumption that this should always be done in
>>doEndTag() because pooling containers don't call release
>>everytime. Can somebody update me on what the final word on that is?
>>
>>Martin
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


RE: Cleanup

Posted by Abey Mullassery <ab...@mullassery.com>.
I was also trying to find out where to put clean up code. Here is the bit I
had found.

>From the JSP 2.0 specification: "The JSP container may reuse classic tag
handler instances for multiple occurrences of the corresponding custom
action, in the same page or in different pages, but only if the same set of
attributes are used for all occurrences."

If the "SAME set of attributes" are used, the properties will be overwritten
even if it is not initialized. But if there are other variables which are
initialized only once in the constructor or so based on the first set of
values it might be a problem.

Either way I thought it was safer to put all clean up in doEndTag() itself.
However I wanted to look into the JSP spec once more.
Regards,

Abey Mullassery
W: http://www.mullassery.com
==============================

> -----Original Message-----
> From: Martin van Dijken [mailto:mvdijken@madocke.nl]
> Sent: Friday, October 10, 2003 1:38 PM
> To: Taglib Developers (E-mail)
> Subject: Cleanup
>
>
> Hey gang,
>
> I was reading through an IO tag to uproot a problem I had. I
> noticed that the tag does all the cleanup in release(), while I
> was under the assumption that this should always be done in
> doEndTag() because pooling containers don't call release
> everytime. Can somebody update me on what the final word on that is?
>
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org