If nobody desagrees, I think SetupRender is the place to initialize the render variables. Anyway, your component seems very simple ; I don't know exactly which will be useful for.... You could use component parameters... I depends on the component...
2010/5/5 Nicolas Bouillon <nico...@bouil.org> > Thank you for you fast response. > > Very disturbing in fact, because I was using this kind of method in lot of > place... and I don't know if the component will be used alone or in a loop. > > So I have to reset such local variable in a @SetupRender each time, or > there is a better solution ? > > Thanks. > > On Wed, 5 May 2010 17:58:41 +0200, Katia Aresti Gonzalez > <katiaare...@gmail.com> wrote: > > Hi, > > > > No, there is no bug. > > > > In the first example you have 2 components, so two contexts. > > > > In the second one you have just one component, so when you loop into it, > it > > increases twice, as you are increasing the same component > > > > Katia > > > > 2010/5/5 Nicolas Bouillon <nico...@bouil.org> > > > >> Hello, > >> > >> I'm facing a strange behaviour on a component. Here if a sample > component > >> : > >> > >> package tapestry.components; > >> > >> import org.apache.tapestry5.MarkupWriter; > >> > >> public class CountComponent { > >> > >> private Integer count = 0; > >> > >> public Integer getCount() { > >> if (count == null) { > >> count = 1; > >> } else { > >> count++; > >> } > >> return count; > >> } > >> > >> public void beginRender(MarkupWriter writer) { > >> writer.element("span"); > >> writer.write("->" + getCount().toString()); > >> writer.end(); > >> } > >> > >> } > >> > >> if if call mutliple type my component like : > >> > >> <t:countComponent /> > >> <t:countComponent /> > >> > >> I got the wanted behavior : > >> > >> -> 1 > >> -> 1 > >> > >> But if i nest my component into a loop like : > >> > >> <t:loop source="items" value="var:item"> > >> <t:countComponent /> > >> </t:loop> > >> > >> I got this behaviour : > >> > >> -> 1 > >> -> 2 > >> etc.. > >> > >> Is this intended or a bug ? > >> > >> Best regards > >> > >> Nicolas. > >> > >> > >> > >> --------------------------------------------------------------------- > >> 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 > >