[prev in list] [next in list] [prev in thread] [next in thread] 

List:       taglibs-dev
Subject:    Re: attribute initialization
From:       "Thomas Colin de Verdiere" <tdeverdiere () scort ! com>
Date:       2002-02-28 14:56:36
[Download RAW message or body]

Thank you so much Shawn

Shawn Bayern wrote:
> 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:taglibs-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>
> 
> 



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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic