I've always had such direct links after their updateComponents and used updateComponents="clientId:componentWrapper" (though nowadays updateComponents="componentWrapper" is equivalent).
So, I never had to have the link before the wrapper - but i believe (though never tried) that peekClientId() in IComponent is for this exact reason, so, in your first example, try updateComponents="ognl:components.componentWrapper.peekClientId()" On 10/23/07, Jim Roycroft <[EMAIL PROTECTED]> wrote: > > > I spent three hours on this silly thing so I hope this post will help you > avoid that! > > I was testing this out with two iterations of the loop, and that's what > caused me grief. As soon as I switched to four iterations, I figured out > what was happening: > > I have a SimplePage.html which includes this: > > < span jwcid="@For" source="ognl:wordList" value="ognl:word" > index="ognl:objectIndex" > > < a href="#" jwcid="@DirectLink" updateComponents="componentWrapper" > listener="listener:showTheWord" parameters="ognl:word">Show the word > < p> > < span jwcid="[EMAIL PROTECTED]"> > < div jwcid="showWordComponent"/> > < /span> > < /p> > < /span> > < /span> > > > I look at the generated page source and the clientId's within the > @DirectLink links don't look right: > > < span id="For"> > < a id="DirectLink" > > href="/playing/SimplePage,$DirectLink.direct?sp=Sfirst&updateParts=componentWrapper" > onclick="return tapestry.linkOnClick(this.href,'DirectLink', false)">Show > the word > < p> > < span id="componentWrapper"> > Word: > < /span> > < /p> > < /span> > < a id="DirectLink_0" > > href="/playing/SimplePage,$DirectLink.direct?sp=Ssecond&updateParts=componentWrapper" > onclick="return tapestry.linkOnClick(this.href,'DirectLink_0', > false)">Show > the word > < p> > < span id="componentWrapper_0"> > Word: > < /span> > < /p> > > Look at the second link... it still shows 'updateParts=componentWrapper' > when it should be 'updateParts=componentWrapper_0'. > > The solution to this is trivial (once you know what's going on!). Simply > move the directlink code below the component in question, so we have: > > < span jwcid="@For" source="ognl:wordList" value="ognl:word" > index="ognl:objectIndex" > > < p> > < span jwcid="[EMAIL PROTECTED]"> > < div jwcid="showWordComponent"/> > < /span> > < /p> > < a href="#" jwcid="@DirectLink" updateComponents="componentWrapper" > listener="listener:showTheWord" parameters="ognl:word">Show the word > < /span> > < /span> > > Now the links will be correct. The reason this happens is that the > @DirectLink component will ask for the componentWrapper clientId on the > first round, and it will default to the componentId because the clientId > has > not been set yet because componentWrapper has not been rendered. The > second > time around, the @DirectLink will still have the wrong value because it > renders before the componentWrapper. > > I hope all that was clear.... if not, please ask questions and I'll be > happy > to re-write and re-word it. > > Jim > > -- > View this message in context: > http://www.nabble.com/-T4.1.3--Tip-for-using-using-directlink-and-updatecomponents-in-a-for-loop-tf4674929.html#a13356699 > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting