You're right, the "id" attribute of the zone will not be "uniqueified" by
Tapestry, so you have to do the job yourself. Also, the "t:id" and "id"
attributes are not the same, they behave differently.

You could perhaps use something like this in your component class:

@Property
private String uniqueZoneId;

@SetupRender
void initUniqueZoneId() {
  String u = generateRandomUniqueString();
  uniqueZoneId = "myZoneId_" + u;
}

And then in your template you could do this:

<t:zone t:id="aZone" id="prop:uniqueZoneId">A Zone!</t:zone>
<t:block t:id="aBlock">A Block!</t:block>
<t:actionLink t:id="anActionLink" t:zone="prop:uniqueZoneId">A
link</t:actionLink>

I may have introduced some errors, but you probably get the idea. Hope it
works!

Inge

On Tue, Aug 18, 2009 at 1:23 AM, Juan E. Maya <maya.j...@gmail.com> wrote:

> That would;t work if the component is inside a loop because the id of
> zone is unique. in this case: aZone. The zone has to be created
> dynamically.
>
> On Tue, Aug 18, 2009 at 12:03 AM, Ted Steen<ted.st...@gmail.com> wrote:
> > Something like this?
> >
> > Index.tml
> > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";
> >      xmlns:p="tapestry:parameter">
> >    <body>
> >        <t:zone t:id="aZone">A Zone!</t:zone>
> >        <t:block t:id="aBlock">A Block!</t:block>
> >        <t:actionLink t:id="anActionLink" t:zone="aZone">A
> link</t:actionLink>
> >    </body>
> > </html>
> >
> > Index.java
> > public class Index
> > {
> >    @Inject
> >    private Block aBlock;
> >
> >    @OnEvent(component = "anActionLink", value = EventConstants.ACTION)
> >    public Block actionFromActionLink()
> >    {
> >        return aBlock;
> >    }
> >
> > }
> >
> > 2008/6/19 Mohan Zhang 
> > <mohanzhang+nab...@gmail.com<mohanzhang%2bnab...@gmail.com>
> >:
> >>
> >> Hi everyone,
> >>
> >> I've been reading the mailing list for a while now and have only seen
> one
> >> post on this topic, which unfortunately did not clarify things for me. I
> >> know this question has probably been asked a few times either indirectly
> or
> >> whatnot, but I'm curious to find out if the problem is something very
> >> fundamental in my understanding, or whether this is just a technical
> issue.
> >>
> >> The question is this: if I have a component which has a zone and an
> >> actionlink (or alternatively an eventlink) which loads a block into the
> >> zone, what's the right way to do this? I've tried using clientId tricks,
> but
> >> this has never been successful for me.
> >>
> >> So to summarize, I have a component which declares its own zone, block,
> and
> >> actionlink. I want this actionlink to load the block into the zone for
> this
> >> component. Now I have a page which has say four of these components and
> I
> >> want each actionlink to affect the appropriate zone. What's the right
> way to
> >> do this?
> >> --
> >> View this message in context:
> http://www.nabble.com/Zones-and-blocks-inside-components-tp17993683p17993683.html
> >> Sent from the Tapestry - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to