Hi Kris, I'd like to avoid the session - as far as possible, say until login has done. What I'd like to do is to set a value in the request in one component and read that value in another component (or the page itself) (both components are in the same page). Like in the example I sent: the action link event handler sets the attribute and the page tries to display that (with no effect :))
hope this is more concrete - and thx you haven't given up helping me out :) janos 2008/4/30 Kristian Marinkovic <[EMAIL PROTECTED]>: > if you inject the Tapestry Request services - available in any pages, > components > and mixins - you can access the HttpSession in an abstract way via the > Session > interface. If you want the real stuff you can inject the RequestGlobals > instance :) > > nevertheless i'd not use the HttpSession directly but try to use one of > the provided > services to do so. For example you can inject the ApplicationStateManager > to > put/get instances from the HttpSession. The only thing you have to be > aware of > is that if you put in a instance with the classname foo.class any page > that declares > @ApplicationState Foo f; will have this instance > > you could also use a PropertyShadowBuilder to abstract the access to a > certain > property/attribute of the HttpSession ... but that's another story :) > > i'm still not sure what your use-case is. if you elaborate more on your > problem > will probably be able to give a more concise advice :) > > g, > kris > > > > > "János Jarecsni" <[EMAIL PROTECTED]> > 30.04.2008 08:50 > Bitte antworten an > "Tapestry users" <users@tapestry.apache.org> > > > An > "Tapestry users" <users@tapestry.apache.org> > Kopie > > Thema > Re: page activation + components > > > > > > > Hi, > > thx for the info! Another idea... is there a HttpRequest like object > available to components and pages? If it were, then setting a request > attribute would be ok for me. Anyway the per-request service is similar to > this, so it will be ok for me. > > thx again > janos > > 2008/4/29 Andy Huhn <[EMAIL PROTECTED]>: > > > > > Hello, > > > > You can define the scope of each service...you can set that particular > > service to be tied to only one session. > > > > See http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html, and > > search for "perthread". > > > > Thanks, > > Andy > > > > On Tue, 29 Apr 2008 18:02:52 +0200, "János Jarecsni" > > <[EMAIL PROTECTED]> wrote: > > > Hi there, > > > > > > the service approach (as I expected) is session-agnostic (and is > > > page-independent so concurrent users would interfere badly), therefore > > is > > > not ok. > > > > > > I will now try the Environment approach... if that is session-aware :) > > > > > > thx again > > > janos > > > > > > 2008/4/29 János Jarecsni <[EMAIL PROTECTED]>: > > > > > >> Hi Chris, > > >> > > >> even so you could help :) I want this kind of generic way of passing > > >> around information (component to component communication :)) so I'll > > > look > > >> for the solutions Kristian and you outlined. > > >> > > >> thanks! > > >> > > >> cheers, > > >> janos > > >> > > >> 2008/4/29 Chris Lewis <[EMAIL PROTECTED]>: > > >> > > >> > Janos, > > >> > > > >> > Without code or a description of your actual goal, I'm finding your > > >> > situation too hypothetical to really digest. The one thing I can > > point > > >> > out is what you said about wanting a component to set a property in > > > the > > >> > page. If you want to do that, then you have to know the class of > the > > >> > page and so injecting a page would make sense. Of course that means > > >> > tightly coupling a component to a page, which to me doesn't make > > > sense. > > >> > If you simply need a generic way of passing data between pages and > > >> > components, consider using a service that provides an untyped list > or > > >> > putting something in the environment as Kristian suggested. I'm > sorry > > > I > > >> > can't be more helpful but as I said I'm not clear on what you're > > > really > > >> > trying to do. > > >> > > > >> > good luck > > >> > chris > > >> > > > >> > János Jarecsni wrote: > > >> > > Hi Chris, > > >> > > > > >> > > I thought of pages as "contexts" for the components embedded > within > > >> > them. > > >> > > So, in one event handler of a component I would like to set some > > >> > property or > > >> > > another (in the page object), and the other components in the > page, > > >> > which > > >> > > are also able to access this property may change their appearance > > >> > (say, the > > >> > > .TML would test the property). Maybe I'm on a wrong track, please > > > let > > >> > me > > >> > > know :) > > >> > > > > >> > > thx > > >> > > Cheers, > > >> > > janos > > >> > > > > >> > > 2008/4/29 Chris Lewis <[EMAIL PROTECTED]>: > > >> > > > > >> > > > > >> > >> 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] > > >> > >> > > >> > >> > > >> > >> > > >> > > > >> > -- > > >> > http://thegodcode.net > > >> > > > >> > > > >> > > --------------------------------------------------------------------- > > >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > > >> > For additional commands, e-mail: [EMAIL PROTECTED] > > >> > > > >> > > > >> > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > >