On Thu, 28 Feb 2002, Thomas Colin de Verdiere wrote: > if we had : > <mytags:MyTag attr1="true"/> //first > <mytags:MyTag/> // second instance > > then for the second instance attr1 is not false but true : as the > container could use MyTag first instance from the first instanciation.
This is a very good question to ask, but it's actually based on an incorrect assumption. The container cannot reuse the same MyTag instance from the first invocation to the second, precisely because its set of attributes is different. Section JSP10.1.1 in the JSP 1.2 spec says the following: "tag handlers can only be reused within the same "AttSet" (set of attributes that have been set)". If my memory is correct, the question you ask is exactly the reason that the spec lays out this requirement: if it didn't, you'd have no place to sensibly initialize default values for subsequent invocations that used fewer attributes than their predecessors. The practical answer is, thus, "You don't need to worry about it." Initializing the instance variable as boolean attr1 = false; is fine. -- Shawn Bayern Author, "JSP Standard Tag Library" http://www.jstlbook.com (coming this spring from Manning Publications) -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>