The decision point for whether a tag instance can be reused is if the values for the optional attribute set are the same (same set of keys and same values for those keys), so I'm pretty sure it's setting all of the properties on the tag instance before reusing it (since it can assume the values of the required attributes will be overwritten by new values.
So I think it would be more like this: Tag tag = new Tag(); tag.setParamA("abc"); tag.setParamB("xyz"); tag.doStartTag(); tag.doEndTag(); //first tag instance tag.setParamA("abc"); tag.setParamB("xyz"); tag.doStartTag(); tag.doEndTag(); //second tag instance > -----Original Message----- > From: Scott Farquhar [mailto:[EMAIL PROTECTED] > Sent: Sunday, September 14, 2003 8:32 PM > To: Matt Ho > Cc: [EMAIL PROTECTED] > Subject: [OS-webwork] Re: clearing out tag values > > > Matt, > > (copying webwork list - I think that they might be interested) > > On Sun, Sep 14, 2003 at 04:05:14PM -0700, Matt Ho wrote: > > Heya Scott, > > > > We've bounced this one around a couple times and I'd like to get it > > resolved. My understanding based on the Jakarta guide and > your comments > > is that JSP tag fields should be cleared out in the > doStartTag() method? > > Is this accurate or do you mean something else? > > Well - all JSP tag properties should be simple setters / > getters, and never modified after being set. > > Anything that needs to be evaluated should be evaluated/set > to null in doStartTag(). This evaluation should not affect > the original setters / getters. > > Nothing should be 'reset' anywhere. If we were using > database connections, we would release those in the release() > method. However, as the release() method is only guaranteed > to be called before garbage collection, there isn't much > point doing anything else here. > > The reason for all this is that tags can be reused, without > resetting the setter values. So if I have > > <ww:tag paramA="abc" paramB="xyz" /> > <ww:tag paramA="abc" paramB="xyz" /> > > Then the code behind this is like: > > Tag tag = new Tag(); > tag.setParamA("abc"); > tag.setParamB("xyz"); > > tag.doStartTag(); > tag.doEndTag(); //first tag instance > > tag.doStartTag(); > tag.doEndTag(); //second tag instance > > > This is the way that it works on resin, which is why you > occasionally see the second tag on a page behaving strangely. > > So - all the tags should behave like the above. > > Let me know where you need a hand. We don't use the taglib > in ww2 (we use velocity), but I can review the code if you > need. Check ww1 for examples of tags that I have rewritten properly. > > Cheers, > Scott > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork