Janos,

I'm having a hard time understanding a case that a component should know
in which page it is embedded, so my suggestion probably wasn't a good
one. Activation contexts aren't meant for components but for pages - you
should be using component parameters to configure them, and if it's a
more sophisticated component, probably a service.

chris

János Jarecsni wrote:
> and how a component can get to know the page in which it is included? I
> mean, I can't @InjectPage, as the component will be included in many kinds
> of pages.
>
> @Kristian: thx for the many ways :) I'll try these, hope that the
> @Environmental stuff is scalable (I'm trying to bypass session creation as
> much as possible)
>
> Is there a doc on the various annotations available?
>
> @Michael:
> Could you include a tiny bit of example? THX!
>
> Thx to you all
> cheers
> janos
>
> 2008/4/29 Chris Lewis <[EMAIL PROTECTED]>:
>
>   
>> 5) @InjectPage the page and call the getter
>>
>> Kristian Marinkovic wrote:
>>     
>>> hi janos,
>>>
>>> there are several possibilities:
>>>
>>> 1) declare a component parameter and pass in the variable
>>>
>>> 2) put it in a ASO and inject the ASO in all your components (using
>>> @ApplicationState)
>>> the drawback is that any other page or component will be able to access
>>> the ASO
>>>
>>> 3) put it into the Environment and read it whereever you need it in your
>>> nested components.
>>> be careful when you put your object in your environment. if you put it
>>>       
>> in
>>     
>>> during the action
>>> request it will not be able in the render request (because of the page
>>> redirect).
>>>
>>> page:
>>>
>>> @Inject Environment env;
>>>
>>> @Persist("flash") whateverclass w;
>>>
>>> onActivate(w) {  this.w= w }
>>>
>>> setupRender() { env.push(whateverclass.class,w);}
>>>
>>> components:
>>>
>>> @Environmental Whateverclass var;
>>>
>>> 4) define a service that can take this variable (and saves it
>>>       
>> appropriatly
>>     
>>> so it is not
>>> lost on a redirect:)) and inject your service in the components where
>>> needed
>>> to retrieve the value.
>>>
>>> maybe there are some more possibilities :)
>>>
>>> g,
>>> kris
>>>
>>>
>>>
>>>
>>> "János Jarecsni" <[EMAIL PROTECTED]>
>>> 29.04.2008 08:15
>>> Bitte antworten an
>>> "Tapestry users" <users@tapestry.apache.org>
>>>
>>>
>>> An
>>> "Tapestry users" <users@tapestry.apache.org>
>>> Kopie
>>>
>>> Thema
>>> page activation + components
>>>
>>>
>>>
>>>
>>>
>>>
>>> Hi there,
>>>
>>> I have an activatable page, in its onActivate(String param) method I
>>>       
>> save
>>     
>>> the param to a normal instance variable of the page class (no
>>> persistence!).
>>> How can any component embedded within this page access this variable?
>>>
>>> the page class:
>>>
>>> //...
>>> private String param;
>>>
>>> public void onActivate(String param) {
>>>    this.param = param;
>>> }
>>>
>>>
>>> public String getParam() {...}
>>>
>>>
>>> Thx in advance!
>>> Janos
>>>
>>>
>>>
>>>       
>> --
>> http://thegodcode.net
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>     

-- 
http://thegodcode.net


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

Reply via email to