You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/02/18 19:51:11 UTC

DO NOT REPLY [Bug 17173] - FormTag lookup() method not reliable due to release() method specification

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17173>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17173

FormTag lookup() method not reliable due to release() method specification

martinc@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



------- Additional Comments From martinc@apache.org  2003-02-18 18:51 -------
There isn't a problem with the Struts 1.1 version of the form tag. Here's why.

A tag handler instance can only be reused by the container when the set of 
attributes specified is the same as the set specified for the previous usage. 
As an example, if you had this on a page:

  <html:form action="/DoThis" name="foo">

and then later on the page you had this:

  <html:form action="/DoThat" name="bar">

the container could elect to use the same tag handler instance because the set 
of attributes specified - i.e. { action, name } - is the same for both tags. 
If, however, you had this later on the page:

  <html:form action="/DoTheOther">

the container cannot use the same tag handler instance, because the set of 
attributes in this case - { action } - is not the same as that of the previous 
tag instances.

With regard to the release() method, after the container calls it, all of a 
tag's attributes are deemed to have undefined values. As such, the container 
cannot make any assumptions about the values, and must explicitly set all 
specified attribute values if it chooses to reuse the tag handler instance.

Different containers definitely have different strategies with respect to tag 
handler reuse. As you noticed, Tomcat 4.1.x does reuse instances, but always 
calls release() after each usage and sets all values next time around. Earlier 
versions of Tomcat do not reuse tag handler instances.

Resin 2.1.x is more aggressive than Tomcat 4.1.x, and maintains attribute sets 
so that it can reuse instances with the lowest cost to performance. This makes 
it (a) faster than Tomcat in processing pages with lots of tags, and (b) an 
excellent testbed for your own tags, to make sure they adhere to all the rules 
of the spec. ;-)

For more on this, the most concise and easy to understand explanation is in the 
JSP 1.2 spec itself. See the section on Lifecycle in JSP.10.1.1, and the 
accompanying diagram.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org