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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to