Re: JSP tags and tag recycling
From: John C. Bollinger (jobollin_at_indiana.edu)
Date: 03/14/05
- Next message: Alan Moore: "Re: Cast, generics and clone problem"
- Previous message: Patricia Shanahan: "Re: Java tools"
- In reply to: plm: "Re: JSP tags and tag recycling"
- Next in thread: plm: "Re: JSP tags and tag recycling"
- Reply: plm: "Re: JSP tags and tag recycling"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 14 Mar 2005 17:45:57 -0500
plm wrote:
> Hello,
>
> Thanks for your explanation.
> I'm not quite sure what you mean by this:
>
>
>>It depends on the details, but such recommendations are typically
>
> flat
>
>>wrong. In part _because_ of tag reuse, it is *forbidden* by JSP for
>
> any
>
>>tag handler state exposed as an attribute, whether optional or
>
> required,
>
>>to be modified by any means other than that attribute, as provided by
>
> a
>
>>page implementation using the handler. Furthermore, it is (or should
>
>
>
> What if a non mandatory attribute has default value "X", and has been
> set to "Y" on the first use of the tag instance? If I do not set the
> value of this attribute back to "X" for example in doEndTag, then what
> happens when the tag instance is being used once more? Are you telling
> that the JSP engine remembers the initial value of the attribute (i.e.
> the default) and then restores it before using the instance again?
When the tag instance is reused, the attribute still has the value "Y",
and THAT IS WHAT THE JSP CONTAINER EXPECTS. In a reuse scenario, the
container is *required* to *avoid* reinitializing any attribute with the
same target value that it already was initialized to. Those details are
moot, however, because JSP specifically says that tag handler properties
exposed as custom action attributes may not be modified other than by
their Javabeans setter methods, and that use of those methods is
reserved for the JSP container. (See JSP 2.0, page 2-51; substantially
the same requirements apply to earlier versions of JSP as well.)
Do note that the spec also says that tag handlers may only be reused
among custom action occurrences where the same set of attributes is
specified (though not necessarily with the same values). Perhaps that
will assuage some of your concern.
-- John Bollinger jobollin@indiana.edu
- Next message: Alan Moore: "Re: Cast, generics and clone problem"
- Previous message: Patricia Shanahan: "Re: Java tools"
- In reply to: plm: "Re: JSP tags and tag recycling"
- Next in thread: plm: "Re: JSP tags and tag recycling"
- Reply: plm: "Re: JSP tags and tag recycling"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|