> -----Original Message-----
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> 
> On Tue, 4 Feb 2003 [EMAIL PROTECTED] wrote:
> >
> > Struts EL tag handlers cannot be reused by containers
> >
> 
> It sounds like these tags definitely have a problem.  There's been
some
> recent discussion on TOMCAT-USER about designing tags that work
reusably
> as well.
> 
> The bottom line:
> 
> * When a tag handler instance is reused, the JSP page
>   compiler can decide if it has already set a particular
>   property on that instance, and omit the second set call.
>   For example, in:
>     <foo:bar a="1" b="2/>
>     <foo:bar a="1" b="3"/>
>   The second setA() call can be omitted, since the container
>   knows that it already called setA("1") the first time.

Does the value of the "rtexprvalue" attribute have any control over this
process, at least in common practice?

> * If a tag instance is going to be reused, the doEndTag()
>   call on the first use is going to be followed by the
>   doStartTag() call of the second use.  Any per-use cleanup
>   activity needs to happen at the end of doEndTag().

Or in doFinally, for for tags implementing TryCatchFinally.

> * The net effect of all this is an important restriction -- it's
>   not legal for a tag handler to modify the values stored by
>   the setter calls from the page, *anywhere* in the path from
>   doStartTag() through doEndTag().

Sigh.  I can see this now.  For reference, section 10.1 (Simple Tag
Handlers) of the JSP specification, in the section "Properties", has
this statement:

"Once properly set, all properties are expected to be persistent, so
that if the JSP container ascertains that a property has already been
set on a given tag handler instance, it needs not set it again. User
code can access property information and access and modify tag handler
internal state starting with the first action method (doStartTag) up
until the last action method (doEndTag or doFinally for tag handlers
implementing TryCatchFinally)."

If we want to release Struts-EL with 1.1, I guess we'll have to advise
users to turn off tag pooling in their containers.  Will that work?

If I now clearly understand how this works (we'll see), I think I know
how to fix this, but it will take considerable manual labor.  In short,
I'll have to change the source code for every EL tag class, and every EL
tag BeanInfo class, adding "shadow" attributes and getters/setters for
every tag attribute.  Although this will be a lot of typing, it's very
straightforward.

I'll also have to build a little test case that clearly demonstrates the
symptom.  Is this easily demonstratable in Tomcat?

I'll start to put this together, but I won't plan on committing it in
the 1.1 timeframe unless we are motivated to want it sooner.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to