Hi James and Firas,

Yes I'm seeing a little light now :)

1) How does getting components from a different page affect the
render/rewind cycle of the current page?
2) What if the Block that comes from another page has some ognl bindings.
How do those get resolved, as I'm now on an entirely different page?
3) What are the best use-cases for such usage?

Thanks, Karthik

On 11/8/06, Firas Adiler <[EMAIL PROTECTED]> wrote:

Hi,

There's IMO an easier way.

Assume
        HtmlBlocks - the page containing the external block(s)
        ClientPage - the page that uses those external blocks

In your ClientPage.page you write:
<inject property="exBlocks" type="page" object="HtmlBlocks" />

And to access these blocks you write:
ognl:exBlocks.components.theNameOfTheBlock

Hope this helps,

</Firas>


-----Original Message-----
From: James Carman [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 07, 2006 1:11 PM
To: Tapestry users
Subject: Re: Question regarding Block/RenderBlock

You can create a page that has a bunch of @Blocks in it and you can use
those blocks in other pages.  We do that in Trails and it works quite
nicely.  Check out the org.apache.tapestry.util.ComponentAddress
class.  It allows you to "look up" components on other pages.  So, you can
use it this way...

public Block getReusableBlockFromAnotherPage() {
  ComponentAddress addr = new ComponentAddress( "MyReusableBlocksPage",
"myReusableBlock" );
  return ( Block )addr.findComponent(getRequestCycle());
}

In your page, you'd do this:

<span jwcid="@RenderBlock" block="ognl:reusableBlockFromAnotherPage" />

This is off the top of my head, so the syntax might not be exactly
correct,
but you get the general idea I hope.  Hope that helps!

On 11/6/06, Karthik N <[EMAIL PROTECTED]> wrote:
> Hello,
>
> "RenderBlock does not mandate that the Block being rendered be
> contained within the page being rendered"
>
> I have seen this statement at so many places - but I am looking for an
> example/explanation of how to do it.
>
> Any pointers?
>
> Thanks, Karthik
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to