tiles-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zach Bailey (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (TILES-339) JSP tags do not reset attributes when reused
Date Tue, 16 Dec 2008 16:03:38 GMT

    [ https://issues.apache.org/struts/browse/TILES-339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45276#action_45276
] 

znbailey edited comment on TILES-339 at 12/16/08 8:02 AM:
-------------------------------------------------------------

I am thinking of the following modifications:

1.) Add an abstract TilesTag and TilesBodyTag which extend TagSupport and BodyTagSupport and
both implement TryCatchFinally.
2.) Existing tag classes which extend TagSupport will now extend TilesTag. Existing tag classes
which extend BodyTagSupport will extend TilesBodyTag.
3.) Both TilesTag and TilesBodyTag will implement doCatch() in the following manner:

public void doCatch(Throwable throwable) throws Throwable {
        throw throwable;
    }

This is a default (no-op) implementation and will result in no change in handling exceptions
thrown from tags.

4.) Both TilesTag and TilesBodyTag will implement doFinally in the following manner:

public void doFinally() {
        //reset any per-invocation resources
        reset();
    }

5.) TilesTag and TilesBodyTag will now define the reset method:

    /**
     * Resets the state of the tag, preparing it for another invocation.
     * Called every invocation after doEndTag via {@link TryCatchFinally#doFinally()}. 
     */
    protected void reset() { }

6.) The release() method will be defined as follows on TilesTag and TilesBodyTag:

/**
     * Release all allocated resources.
     */
    @Override
    public void release() {
        super.release();
        reset();
    }

7.) All logic found in existing release() methods will be moved to the reset() method and
the release() methods removed.

Does anyone see any pitfalls or problems with this approach, or see a better way to resolve
this issue?

      was (Author: znbailey):
    I am thinking of the following modifications:

1.) Add an abstract TilesTag and TilesBodyTag which extend TagSupport and BodyTagSupport and
both implement TryCatchFinally.
2.) Existing tag classes which extend TagSupport will now extend TilesTag. Existing tag classes
which extend BodyTagSupport will extend TilesBodyTag.
3.) Both TilesTag and TilesBodyTag will implement doCatch() in the following manner:

public void doCatch(Throwable throwable) throws Throwable {
        throw throwable;
    }

This is a default (no-op) implementation and will result in no change in handling exceptions
thrown from tags.

4.) Both TilesTag and TilesBodyTag will implement doFinally in the following manner:

public void doFinally() {
        //reset any per-invocation resources
        reset();
    }

5.) TilesTag and TilesBodyTag will now define the reset method:

    /**
     * Resets the state of the tag, preparing it for another invocation.
     * Called every invocation after doEndTag via {@link TryCatchFinally#doFinally()}. 
     */
    protected void reset() { }

6.) The release() method will be defined as follows on TilesTag and TilesBodyTag:

/**
     * Release all allocated resources.
     */
    @Override
    public void release() {
        reset();
    }

7.) All logic found in existing release() methods will be moved to the reset() method and
the release() methods removed.

Does anyone see any pitfalls or problems with this approach, or see a better way to resolve
this issue?
  
> JSP  tags do not reset attributes when reused
> ---------------------------------------------
>
>                 Key: TILES-339
>                 URL: https://issues.apache.org/struts/browse/TILES-339
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.0.6, 2.1.0
>            Reporter: Antonio Petrelli
>            Priority: Blocker
>
> It is simply a misinterpretation of the Tag.release method:
> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html#release()
> Attribute reset must be done in the "doEndTag"!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message