Re: Why Components in Loop are the only one instance? What should I do?
> Is there some other solutions? If sometimes I put my existing complex > Component into a Loop, It will not work. There are many solutions. It all depends on where your complexity is. It sounds like you need to work out a communication mechanism between your component and it's container. Presumably you are passing your parameters to your component via a property binding. What you probably want to do then is have the containing page reset all of the properties to the state they were in at whatever iteration rendered your component. You could do that by triggering an event from your component which instructs the container to set all the bound parameters based on some context from the originating event. Have a look at: http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/ComponentResourcesCommon.html#triggerEvent(java.lang.String, java.lang.Object[], org.apache.tapestry5.ComponentEventCallback) Josh On Tue, Jan 3, 2012 at 7:16 PM, Bo Gao wrote: >>> I have changed all the values I want to persist to context values and it >>> works for me now.> Is this the only way to solve this problem? >> >> Probably not, but it seems like a fine solution. > > Is there some other solutions? If sometimes I put my existing complex > Component into a Loop, It will not work. > > > On Jan 4, 2012, at 1:44 AM, Josh Canfield wrote: > >>> I have changed all the values I want to persist to context values and it >>> works for me now.> Is this the only way to solve this problem? >> >> Probably not, but it seems like a fine solution. >> On Mon, Jan 2, 2012 at 6:04 PM, Elivoa wrote: >>> I have a zone in my component. And an event link to refresh the zone. >>> So I need to use a persists value to store the zone's client id, and I >>> persist some value that will show inside the zone. >>> >>> I have changed all the values I want to persist to context values and it >>> works for me now. >>> Is this the only way to solve this problem? >>> >>> Sent from my iPad >>> >>> On 2012-1-3, at 4:08, Josh Canfield wrote: >>> This is by design. Tapestry pages/ components have static structure so no matter how many times you g through the loop you only get one instance of the component. What specifically are you trying to do? Maybe someone can offer some design tips. Josh On Jan 2, 2012 12:17 AM, "Bo Gao" wrote: > I put a Component in a Loop, and when I call System.out.println(this); I > found that there are only one instance of the component. If I have some > persist value in this Components they can't work well. > > Why this happened? What should I do if I want to put a Complex Component > with persist value into a Loop? > > Thanks > > -- > Bo Gao > eli...@gmail.com > > > > > > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> > > -- > Bo Gao > eli...@gmail.com > > > > > > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Why Components in Loop are the only one instance? What should I do?
>> I have changed all the values I want to persist to context values and it >> works for me now.> Is this the only way to solve this problem? > > Probably not, but it seems like a fine solution. Is there some other solutions? If sometimes I put my existing complex Component into a Loop, It will not work. On Jan 4, 2012, at 1:44 AM, Josh Canfield wrote: >> I have changed all the values I want to persist to context values and it >> works for me now.> Is this the only way to solve this problem? > > Probably not, but it seems like a fine solution. > On Mon, Jan 2, 2012 at 6:04 PM, Elivoa wrote: >> I have a zone in my component. And an event link to refresh the zone. >> So I need to use a persists value to store the zone's client id, and I >> persist some value that will show inside the zone. >> >> I have changed all the values I want to persist to context values and it >> works for me now. >> Is this the only way to solve this problem? >> >> Sent from my iPad >> >> On 2012-1-3, at 4:08, Josh Canfield wrote: >> >>> This is by design. Tapestry pages/ components have static structure so no >>> matter how many times you g through the loop you only get one instance >>> of the component. >>> >>> What specifically are you trying to do? Maybe someone can offer some design >>> tips. >>> >>> Josh >>> On Jan 2, 2012 12:17 AM, "Bo Gao" wrote: >>> I put a Component in a Loop, and when I call System.out.println(this); I found that there are only one instance of the component. If I have some persist value in this Components they can't work well. Why this happened? What should I do if I want to put a Complex Component with persist value into a Loop? Thanks -- Bo Gao eli...@gmail.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > -- Bo Gao eli...@gmail.com
Re: Why Components in Loop are the only one instance? What should I do?
> I have changed all the values I want to persist to context values and it > works for me now.> Is this the only way to solve this problem? Probably not, but it seems like a fine solution. On Mon, Jan 2, 2012 at 6:04 PM, Elivoa wrote: > I have a zone in my component. And an event link to refresh the zone. > So I need to use a persists value to store the zone's client id, and I > persist some value that will show inside the zone. > > I have changed all the values I want to persist to context values and it > works for me now. > Is this the only way to solve this problem? > > Sent from my iPad > > On 2012-1-3, at 4:08, Josh Canfield wrote: > >> This is by design. Tapestry pages/ components have static structure so no >> matter how many times you g through the loop you only get one instance >> of the component. >> >> What specifically are you trying to do? Maybe someone can offer some design >> tips. >> >> Josh >> On Jan 2, 2012 12:17 AM, "Bo Gao" wrote: >> >>> I put a Component in a Loop, and when I call System.out.println(this); I >>> found that there are only one instance of the component. If I have some >>> persist value in this Components they can't work well. >>> >>> Why this happened? What should I do if I want to put a Complex Component >>> with persist value into a Loop? >>> >>> Thanks >>> >>> -- >>> Bo Gao >>> eli...@gmail.com >>> >>> >>> >>> >>> >>> >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >>> > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Why Components in Loop are the only one instance? What should I do?
I have a zone in my component. And an event link to refresh the zone. So I need to use a persists value to store the zone's client id, and I persist some value that will show inside the zone. I have changed all the values I want to persist to context values and it works for me now. Is this the only way to solve this problem? Sent from my iPad On 2012-1-3, at 4:08, Josh Canfield wrote: > This is by design. Tapestry pages/ components have static structure so no > matter how many times you g through the loop you only get one instance > of the component. > > What specifically are you trying to do? Maybe someone can offer some design > tips. > > Josh > On Jan 2, 2012 12:17 AM, "Bo Gao" wrote: > >> I put a Component in a Loop, and when I call System.out.println(this); I >> found that there are only one instance of the component. If I have some >> persist value in this Components they can't work well. >> >> Why this happened? What should I do if I want to put a Complex Component >> with persist value into a Loop? >> >> Thanks >> >> -- >> Bo Gao >> eli...@gmail.com >> >> >> >> >> >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Why Components in Loop are the only one instance? What should I do?
This is by design. Tapestry pages/ components have static structure so no matter how many times you g through the loop you only get one instance of the component. What specifically are you trying to do? Maybe someone can offer some design tips. Josh On Jan 2, 2012 12:17 AM, "Bo Gao" wrote: > I put a Component in a Loop, and when I call System.out.println(this); I > found that there are only one instance of the component. If I have some > persist value in this Components they can't work well. > > Why this happened? What should I do if I want to put a Complex Component > with persist value into a Loop? > > Thanks > > -- > Bo Gao > eli...@gmail.com > > > > > > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Why Components in Loop are the only one instance? What should I do?
I put a Component in a Loop, and when I call System.out.println(this); I found that there are only one instance of the component. If I have some persist value in this Components they can't work well. Why this happened? What should I do if I want to put a Complex Component with persist value into a Loop? Thanks -- Bo Gao eli...@gmail.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org