I don't think this may help but tapestry modifies your pages\components at the run time so it's all handled behind the scenes. Although I can't explain the results of your test here !
On Tue, Jun 5, 2012 at 4:50 AM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > On Mon, 04 Jun 2012 21:56:28 -0300, xieweiguo <xiewei...@139.com> wrote: > > Hello! >> > > Hi! > > > I heard that from tapepstry 5.2,all page is singleton-object.But,I write >> some code in the constructor of page class like this: >> > > You should avoid using constructors in page classes. > > > So,my question is: Is the page singleton? >> > > Yes. The class is changed transparently by the Tapestry classloader in > runtime so access to fields is changed to access to a per-thread map. > > > If I want to do something just >> once in a page,what should I do(use synchronized?)? >> > > Your question doesn't make sense. synchronized is used when you have > threads. > > > and, if I want a >> singleton component( such as common parts of all pages),what should I do? >> > > There's no such thing as a singleton component. You need to do nothing for > a component to be used in more than one page. > > -- > Thiago H. de Paula Figueiredo > > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: > users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org> > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- *Regards,* *Muhammad Gelbana Java Developer*