Hello,

Am I correct in thinking that when a component is acquired from the pool
it's state should be reset?
I'm asking because I've noticed that when rendering components repeatedly in
a loop the state doesn't get reset.

Here's the test component I've used:

public class Test {

    @Property
    private int a;

    void setupRender() {
        a++;
    }
}
with corresponding component html:

<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
    ${a}
</t:container>


Here's the page i used to test the component.


<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
<body>

    <h3>Looped references</h3>
    <t:loop source="1..3" >
        <t:test/>
    </t:loop>

    <h3>Static references</h3>
    <t:test/>
    <t:test/>
    <t:test/>

</body>
</html>

The output is:
Looped references 1 2 3 Static references 1 1 1

I know i could reset variables in a cleanup render method but shouldn't the
component behave the same way inside or outside of a loop?
Many thanks,

Jack

Reply via email to