If the context needs to be shared, it needs to be exposed to the rest of the
environment in some way.
One option is for the page to implement an interface; components get get the
page (from ComponentResources) and cast it to the interface to obtain the
desired information.

Another option is a per-thread service that stores the data; the page
injects the service and invokes the setter method(s), the components inject
the service and invoke the getter method(s).

A third option, used when rendering, it to collect the context information
into an object stored into the Environment; components can use
@Environmental injection (a special kind of per-thread data binding) to
access the values.

On Sun, Sep 13, 2009 at 8:30 AM, ningdh <ningd...@gmail.com> wrote:

> What about injecting ComponentEventLinkEncoder and Request to the component
> and call #decodePageRenderRequest(request) to get
> PageRenderRequestParameters.
> It contains the activationContext.
>
> DH
> http://www.gaonline.com.cn
>
> ----- Original Message -----
> From: "chakra"
> To: <users@tapestry.apache.org>
> Sent: Sunday, September 13, 2009 6:36 PM
> Subject: Accessing page context from a component
>
>
> >
> > Hi All,
> > Is there any easy way of accessing page context from within a component?
> >
> > I have a page page1 containing components comp1 and comp2
> >
> > I am accessing the page as http://localhost:8080/page/param1/param2
> >
> > in Page class ,I can access param1 and param2 by simply writing an
> > onActivate method.
> >
> > Is there any way of achieving the same inside comp1 and comp2 also?
> >
> >
> > Chakra
> > --
> > View this message in context:
> http://www.nabble.com/Accessing-page-context-from-a-component-tp25422102p25422102.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
> >
> >
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to learn
how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

Reply via email to