Thanks for the answer, and sorry for the duplicated mails (our mail server has problems),
This solution works well, but I really can't see why the behaviour is different : the actionlink is the same in the 2 situations explained below. Or does it simply mean that we should not use persisting attributes in components when there is a loop ? Kind regards, Ahingsaka Le jeudi 26 mars 2009 à 15:27 +0100, Joachim Van der Auwera a écrit : > You should pass the "usage" string as context parameter on the action link. > The problem is that the url for each of the events in the loop are the same. > > Kind regards, > Joachim > > ahingsaka samsenesena wrote: > > Hi, > > > > I'm trying to use my own component inside a loop and I have a problem > > when there is a "persist" annotation on attributes. > > > > I want to loop with my component named "test" in a page like this : > > > > <t:zone t:id="refreshZone"/> > > > > <t:loop source="0..2" value="testId"> > > <t:test usage="${usage}"/> > > </t:loop> > > > > The component contains a string attribute "usageValue" that will be > > displayed in the refreshZone. > > This attribute comes from the parameter "usage". I put my value on the > > setupRender method. > > > > The class of the component is like this : > > public class Test { > > > > @Parameter > > private String usage; > > > > @Persist > > @Property > > private String usageValue; > > > > @Inject > > private Block refreshBlock; > > > > boolean setupRender(MarkupWriter writer) { > > this.usageValue = usage; > > return true; > > } > > > > Object onActionFromClick() { > > return refreshBlock; > > } > > } > > > > And the tml : > > <t:block t:id="refreshBlock"> > > ${usageValue} > > </t:block> > > > > <t:actionlink t:id="click" t:zone="refreshZone">Click > > me</t:actionlink><br/> > > > > The controller of the page is quite simple and returns an usage for a > > given number > > public class ContentTest { > > > > @Property > > private int testId; > > > > public String getUsage() { > > if (testId == 0) { > > return "pix"; > > } else if (testId == 1) { > > return "zoom"; > > } else if (testId == 2) { > > return "thumb"; > > } else > > return ""; > > > > } > > } > > > > Here is the problem : when I click on the link, the value displayed is > > always "thumb" ! > > I should have "pix" displayed with the first link, "zoom" with the > > second ... > > > > I tried to put an id, but the behaviour is the same : > > <t:loop source="0..2" value="testId"> > > <t:test t:id="testId" usage="${usage}"/> > > </t:loop> > > > > And if I don't use the loop, there is no problem : > > <t:zone t:id="refreshZone"/> > > <t:test usage="literal:pix"> > > </t:test> > > <t:test usage="literal:zoom"> > > </t:test> > > <t:test usage="literal:thumb"> > > </t:test> > > > > If I use these lines, i have the right behaviour. > > > > What's going on ? > > > > Ahingsaka SAMSENESENA > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org