You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nick Stuart <ba...@gmail.com> on 2005/06/22 16:49:59 UTC

Re: Number of component instances on a page

Components, just like pages are pooled, and are expected to be
stateless and thread safe. I believe that you are in fact only getting
1 component on your page, its just being spit out multiple times. And
in fact, if you go to another page with the same component, and with
permitting factors, you will again get that same component.

(some on shout if I'm off base here, but thats my understanding)

-Nick

On 6/22/05, Edward Scanzano <es...@yahoo.com> wrote:
> 
> Hi all,
> 
> I have a situtation where I have a page that includes
> 0..n number of a component (let's call it A). I have
> A.jwc A.html and A.java. Will tapestry create only one
> A java object to represent each component or will each
> component get it own java object instance. I noticed
> that in my constructor for A it is getting called only
> once and I have 2 components of type A on the page.
> 
> Thanks
> E
> 
> 
> >
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Number of component instances on a page

Posted by Edward Scanzano <es...@yahoo.com>.
Actually, I am only seeing one execution of the
constructor for that component. That is what is
confusing me. For this page, there is only one .java
class being instantiated for the component.



--- Howard Lewis Ship <hl...@gmail.com> wrote:

> Components are only cached as part of a page. I
> think there's a
> communication issue here; if he's using the same
> component twice on a
> page, he'll see the constructor invoked twice.  Are
> we talking loops
> here?  A loop renders its body multiple times, it
> doesn't create
> multiple instances of its body.
> 
> On 6/22/05, Nick Stuart <ba...@gmail.com> wrote:
> > Components, just like pages are pooled, and are
> expected to be
> > stateless and thread safe. I believe that you are
> in fact only getting
> > 1 component on your page, its just being spit out
> multiple times. And
> > in fact, if you go to another page with the same
> component, and with
> > permitting factors, you will again get that same
> component.
> > 
> > (some on shout if I'm off base here, but thats my
> understanding)
> > 
> > -Nick
> > 
> > On 6/22/05, Edward Scanzano <es...@yahoo.com>
> wrote:
> > >
> > > Hi all,
> > >
> > > I have a situtation where I have a page that
> includes
> > > 0..n number of a component (let's call it A). I
> have
> > > A.jwc A.html and A.java. Will tapestry create
> only one
> > > A java object to represent each component or
> will each
> > > component get it own java object instance. I
> noticed
> > > that in my constructor for A it is getting
> called only
> > > once and I have 2 components of type A on the
> page.
> > >
> > > Thanks
> > > E
> > >
> > >
> > > >
> > >
> > >
> > >
> > >
> > >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> > >
> > >
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> -- 
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator, Jakarta Tapestry
> Creator, Jakarta HiveMind
> 
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Number of component instances on a page

Posted by Howard Lewis Ship <hl...@gmail.com>.
Components are only cached as part of a page. I think there's a
communication issue here; if he's using the same component twice on a
page, he'll see the constructor invoked twice.  Are we talking loops
here?  A loop renders its body multiple times, it doesn't create
multiple instances of its body.

On 6/22/05, Nick Stuart <ba...@gmail.com> wrote:
> Components, just like pages are pooled, and are expected to be
> stateless and thread safe. I believe that you are in fact only getting
> 1 component on your page, its just being spit out multiple times. And
> in fact, if you go to another page with the same component, and with
> permitting factors, you will again get that same component.
> 
> (some on shout if I'm off base here, but thats my understanding)
> 
> -Nick
> 
> On 6/22/05, Edward Scanzano <es...@yahoo.com> wrote:
> >
> > Hi all,
> >
> > I have a situtation where I have a page that includes
> > 0..n number of a component (let's call it A). I have
> > A.jwc A.html and A.java. Will tapestry create only one
> > A java object to represent each component or will each
> > component get it own java object instance. I noticed
> > that in my constructor for A it is getting called only
> > once and I have 2 components of type A on the page.
> >
> > Thanks
> > E
> >
> >
> > >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Number of component instances on a page

Posted by Edward Scanzano <es...@yahoo.com>.
This is exactly what I do not want. How do I prevent
this and make it so that they are individual instances
and not shared.

Ed

--- Nick Stuart <ba...@gmail.com> wrote:

> Components, just like pages are pooled, and are
> expected to be
> stateless and thread safe. I believe that you are in
> fact only getting
> 1 component on your page, its just being spit out
> multiple times. And
> in fact, if you go to another page with the same
> component, and with
> permitting factors, you will again get that same
> component.
> 
> (some on shout if I'm off base here, but thats my
> understanding)
> 
> -Nick
> 
> On 6/22/05, Edward Scanzano <es...@yahoo.com>
> wrote:
> > 
> > Hi all,
> > 
> > I have a situtation where I have a page that
> includes
> > 0..n number of a component (let's call it A). I
> have
> > A.jwc A.html and A.java. Will tapestry create only
> one
> > A java object to represent each component or will
> each
> > component get it own java object instance. I
> noticed
> > that in my constructor for A it is getting called
> only
> > once and I have 2 components of type A on the
> page.
> > 
> > Thanks
> > E
> > 
> > 
> > >
> > 
> > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> > 
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org