Thanks, I forgot to mention that I am also using tapestry 3, so your solution will apply. I´ll give it a try.
On 10/18/05, Johan Maasing <[EMAIL PROTECTED]> wrote: > Raul Cesar Teixeira wrote: > > Hi, > > I am having some trouble with IDs generated for anonymous components. > > Here is my situation: > > > > I created a simple component (based on basecomponent) that will render > > a pop up menu. If I put 3 instances of this component directly inside > > a page, I get three unique ids (as I expected). However, if I nest the > > component within a FOREACH component (that has 3 iterations), I get > > the same ID 3 times. Is this how it´s supposed to work? I´m fairly new > > to tapestry, so I may have misunderstood the way component IDs are > > supposed to work. Here are the relevant pieces from the templates: > > > > THIS WORKS, RENDERING IDS: $MenuTemp$0, $MenuTemp$1, $MenuTemp$3: > > <span jwcid="@MenuTemp" /><br> > > <span jwcid="@MenuTemp" /><br> > > <span jwcid="@MenuTemp" /><br> > > > > THIS RENDERS IDS: $MenuTemp, $MenuTemp, $MenuTemp > > <span jwcid="@Foreach" source="ognl:listOfStuff" > > > <span jwcid="@MenuTemp" /><br> > > </span> > > > > The listOfStuff is just a static arraylist with 3 elements. > > > > The MenuTemp component does not have a JAVA class. Here is the > > relevant code in the specification: > > <component-specification class="org.apache.tapestry.BaseComponent" > > allow-body="yes" > > allow-informal-parameters="yes"> > > I only use Tapestry 3 so this might not apply to Tap4 but I think this > is how it is supposed to work. MenuTemp is only instantiated once, but > it is invoked three times to render itself. > The ForEach component has a value property that can be used to provide > data to components it wraps. So the wrapped component (MenuTemp in this > case) can use this value to render itself with the row data. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
