This seems very similar to the bug I filed for dbtags last week.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13667
Is someone going to go through and clean up these pooling issues?  Or should
we be submitting patches?
-----Original Message-----
From: Mike Cantrell [mailto:Mike.Cantrell@;ind.alcatel.com] 
Sent: Tuesday, October 22, 2002 12:31 PM
To: Tag Libraries Users List
Subject: release() methods for jakarta taglibs


We are encountering some problems with the Jakarta Taglibs with newer 
servlet containers that pool the tag objects (Tomcat  4.1.x and JRun 
4.0). Most of the tags I looked through don't override the release() 
method to reset the initial values and do cleanup.

For instance, the mailer taglib has a tag called mt:addrecipient. If you 
use this tag, each time the page is called the value is just appended to 
the original value. Are there any plans to go through these tags and 
make them "pool safe"?

Example:

    <mt:mail server="smtp">
        <mt:from><c:out value="${param.mail_from}" 
escapeXml="false"/></mt:from>
        <mt:subject><c:out value="${param.subject}" 
escapeXml="false"/></mt:subject>
        <c:forEach var="email" items="${emailList}">
            <mt:addrecipient type="to"><c:out value="${email}" 
escapeXml="false"/></mt:setrecipient>
        </c:forEach>
        <mt:message type="html">
            <div style="width: 500px;">
                <c:out value="${param.body}" escapeXml="false"/>
            </div>
        </mt:message>
        <mt:send/>
    </mt:mail>

Let's assume that emailList contains the addresess: [EMAIL PROTECTED] and 
[EMAIL PROTECTED]

The first time the page is processed, the email sends out emails to:

     [EMAIL PROTECTED], [EMAIL PROTECTED]

If you hit reload, the email sends out to:

     [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]

and if you hit reload again, the email sends out to:
     [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], 
[EMAIL PROTECTED], [EMAIL PROTECTED],
     [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]


I've double checked the emailList  and it only contains the original 2 
elements each time the page reloads. It appears that the taglib is 
simply adding  the list to the old list from the Object obtained from 
the pool since there's no release() method to reset the tag's initial data.



--
To unsubscribe, e-mail:
<mailto:taglibs-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:taglibs-user-help@;jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@;jakarta.apache.org>

Reply via email to