>>>>> "Craig" == Craig R McClanahan <[EMAIL PROTECTED]> writes:
Craig> On 28 Jul 2002, David M. Karr wrote:
>> Is there some reason the Struts custom tags have redundant initializations of
>> their instance variables, once as implicit initializations, and once in the
>> "release()" method? I hope that this code is either generated, or someone has
>> carefully examined every single one to verify that the implicit init. value is
>> identical to the value it's set to in "release()".
>>
>> It would seem to me that a better strategy would be to write a private "init()"
>> method which initializes all the instance variables to their initial state, and
>> which is called from the "release()" method and a new no-args constructor (I
>> would guess that none of the tags have a defined constructor).
>>
>> Is there a good reason for how this currently works?
Craig> It actually turns out that initializing to non-null values tends to get
Craig> you in trouble in containers that recycle tag instances -- we really need
Craig> to go through and rip that out (as well as the tendency to modify the
Craig> specified attribute values during doStartTag() or doEndTag(), which will
Craig> cause nothing but grief with optimizing page compilers.
The issues with recycled tag instances is exactly why I was looking at this. I
assume, by this statement, that you agree the current strategy isn't right? If
so, I'll submit a bug for this. I plan on building a patch for this myself,
but I'm not certain when I'll get to this. As I described, I would remove the
implicit initializations, implement the "init()" method with the correct
initializations, create a no-args constructor, and call the "init()" method
from both "release()" and the no-args constructor. That should just take a few
minutes to modify very tag :) .
Do you have a good example of your other statement, about modifying the
specified attribute values in the tag methods? I may have seen that, but I
want to be sure I know what you're referring to.
--
===================================================================
David M. Karr ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>