Re: Re: Re: access component variable
nille hammer wrote: > > Hi Cid, > > I have just been to the toilett and have thought about your question. > Maybe you could nest component B in component A directly rather than in > the page? Example follows: > > in page.tml > ... > > ... > > in a.tml > ... > > > > how can i get value from A ? > suppose A has variable > private String ID; > > public String getId() { > return ID; > } > > can i use ? > ... > > Would that be an option? > > Regards, nillehammer > > == > http://www.winfonet.eu > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://www.nabble.com/access-component-variable-tp24240467p24269162.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
Re: Re: Re: access component variable
I tried using Environment and it works..but i have a doubt A and B both are defined as component in my page... code snippet is like : page.java @Component private A a; @Component private B b; void beforeRender() { envoronment.push(A.class,a); } void afterRender() { environment.pop(A.class); } so does this ensure that when component B is called and i try to peek A from environment...A would already have been initialized and executed, so that i get valid ID ? nille hammer wrote: > > Hi Cid, > > I have just been to the toilett and have thought about your question. > Maybe you could nest component B in component A directly rather than in > the page? Example follows: > > in page.tml > ... > > ... > > in a.tml > ... > > > ... > > Would that be an option? > > Regards, nillehammer > > == > http://www.winfonet.eu > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://www.nabble.com/access-component-variable-tp24240467p24269099.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
Re: Re: Re: access component variable
Hi Cid, I have just been to the toilett and have thought about your question. Maybe you could nest component B in component A directly rather than in the page? Example follows: in page.tml ... ... in a.tml ... ... Would that be an option? Regards, nillehammer == http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Re: access component variable
Hi Cid, in my opinion compontents should be independently usable. In your scenario component B depends on a value fetched by component A and even worse on the order of events that component A fires (Is value available after BeforeRender of A or after BeginRender etc.? When to peek it from Environment in component B?). You might be able to solve the problems mentioned above. But I would suggest either injecting the service that fetches the value into the page that contains the two components. And just hand over the value as parameters to the two components. Or, as the two components are not really independent, think about making just one of them. Regards, nillehammer == http://www.winfonet.eu - original Nachricht Betreff: Re: access component variable Gesendet: Mo, 29. Jun 2009 Von: Captain Cid > > i have one component..which tries to get a ID (primary key) and some other > info from database and renders it... > another component needs this ID to query DB and render some other > information...other way is that it has to make unnecessary same query to > first get ID and then use it ! So what do you suggest ? > > > > > nille hammer wrote: > > > > Hi Cid, > > > > You could use Tapestry's Envronment feature. Look here for documentation: > > http://tapestry.apache.org/tapestry5.1/guide/env.html > > > > Although I think you should design your components a bit differently, so > > that you don't need to do this. Maybe you could give us some more details > > on your special use case and we can find another solution. > > > > Regards, nillehammer > > > > == > > http://www.winfonet.eu > > > > --- > > Betreff: access component variable > > Gesendet: So, 28. Jun 2009 > > Von: Captain Cid > > > >> > >> hi, > >> > >> i have page with 2 components A and B...i want to access 1st components > >> variable say "foo" (A.foo) after it is invoked in component B..how can i > >> do > >> so ? > >> -- > >> View this message in context: > >> http://www.nabble.com/access-component-variable-tp24240467p24240467.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 > >> > >> > > > > --- original Nachricht Ende > > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > > > > > -- > View this message in context: > http://www.nabble.com/access-component-variable-tp24240467p24252626.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 > > --- original Nachricht Ende - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: access component variable
i have one component..which tries to get a ID (primary key) and some other info from database and renders it... another component needs this ID to query DB and render some other information...other way is that it has to make unnecessary same query to first get ID and then use it ! So what do you suggest ? nille hammer wrote: > > Hi Cid, > > You could use Tapestry's Envronment feature. Look here for documentation: > http://tapestry.apache.org/tapestry5.1/guide/env.html > > Although I think you should design your components a bit differently, so > that you don't need to do this. Maybe you could give us some more details > on your special use case and we can find another solution. > > Regards, nillehammer > > == > http://www.winfonet.eu > > ------- > Betreff: access component variable > Gesendet: So, 28. Jun 2009 > Von: Captain Cid > >> >> hi, >> >> i have page with 2 components A and B...i want to access 1st components >> variable say "foo" (A.foo) after it is invoked in component B..how can i >> do >> so ? >> -- >> View this message in context: >> http://www.nabble.com/access-component-variable-tp24240467p24240467.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 >> >> > > --- original Nachricht Ende > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://www.nabble.com/access-component-variable-tp24240467p24252626.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
Re: access component variable
Hi Cid, You could use Tapestry's Envronment feature. Look here for documentation: http://tapestry.apache.org/tapestry5.1/guide/env.html Although I think you should design your components a bit differently, so that you don't need to do this. Maybe you could give us some more details on your special use case and we can find another solution. Regards, nillehammer == http://www.winfonet.eu --- Betreff: access component variable Gesendet: So, 28. Jun 2009 Von: Captain Cid > > hi, > > i have page with 2 components A and B...i want to access 1st components > variable say "foo" (A.foo) after it is invoked in component B..how can i do > so ? > -- > View this message in context: > http://www.nabble.com/access-component-variable-tp24240467p24240467.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 > > --- original Nachricht Ende - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
access component variable
hi, i have page with 2 components A and B...i want to access 1st components variable say "foo" (A.foo) after it is invoked in component B..how can i do so ? -- View this message in context: http://www.nabble.com/access-component-variable-tp24240467p24240467.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