why can you not? you can keep an instance in your session subclass and whenever you need it pull it out and set it as the response page.

all i was trying to tell you is that
1) it is not practical because it forces your hierarchy to be static, or you must have some "reset" mechanism
2) it will not greatly improve the performance



-Igor


On 3/21/06, ali <[EMAIL PROTECTED] > wrote:
On Tue, 21 Mar 2006 13:49:02 +0530, Igor Vaynberg
< [EMAIL PROTECTED]> wrote:

i told in my first post , i talk about singleton of thread/session level
instead application level

i repeat my FAQ only to inform myself: is it good/possible that for a user
in a session , create only one instance of PageA ?

> if i recall from the podcast HLS says that in his mind pages have a
> fairly
> static component hierarchy - this is why it is easy to pool them. once
> you
> create a page you dont really add/change components - that is the
> tapestry
> model for the most part.
>
> in wicket pages are dynamic, you are free to change the hierarchy at any
> time in any way that you want - this is why a singleton page makes little
> sense.
>
> as i said before, this is a non issue until it shows up as a hotspot.
> until
> then you are optimizing way too prematurely.
>
> -Igor
>
>
> On 3/20/06, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
>>
>> You probably can manage to make the page a singleton, but I strongly
>> discourage you from trying.
>>
>> You are in a multithreaded environment. Wicket pages are stateful, which
>> means you can't safely share them across threads. As a consequence a
>> page
>> can not be shared between sessions, and that is what you do when you
>> build a
>> singleton.
>> When you let Wicket 'manage' your pages, i.e. you just create pages on
>> the
>> fly, you won't run into multithreading problems. Wicket will
>> synchronize for
>> each session on the session with an incoming request. So per user you
>> won't
>> have threading issues.
>>
>> I can't think of any web framework that supports this way of working,
>> perhaps the action oriented frameworks (webwork, struts). Wicket is not
>> like
>> that. Wicket creates statefull pages and components, which means they
>> cannot
>> be shared between threads at the same time. Even Tapestry doesn't
>> support
>> singletons, but uses page pooling. And because of that, they had to
>> create
>> some magic to make the pages loose their state when the page is put back
>> into the pool.
>>
>> If you are /that/ concerned with memory, then you probably shouldn't use
>> Wicket. Not because we don't think Wicket is up for the task, but I
>> think
>> you'd have more fun with Tapestry or another framework that let's you
>> work
>> the way you want.
>>
>> Martijn
>>
>>
>>
>> On 3/21/06, ali < [EMAIL PROTECTED]> wrote:
>> >
>> > On Tue, 21 Mar 2006 04:47:13 +0530, Martijn Dashorst
>> > < [EMAIL PROTECTED]> wrote:
>> >
>> > i want suppose can EditBook be is singleton .
>> >
>> > > new Link("editLink") {
>> > >     protected void onClick() {
>> > >         Book book = (Book)getParent().getModelObject();
>> > >         setResponsePage(new EditBook(book));
>> > >     }
>> > > }
>> > >
>> > > Should work.
>> > >
>> > > Martijn
>> > >
>> > > On 3/20/06, ali <[EMAIL PROTECTED]> wrote:
>> > >>
>> > >> On Mon, 20 Mar 2006 14:18:48 +0530, Johan Compagner
>> > >> < [EMAIL PROTECTED]>
>> > >> wrote:
>> > >> can i do like :
>> > >>
>> > >> class BookList extends WebPage {
>> > >>
>> > >>         public BookList() {
>> > >>
>> > >>                 add(new ListView("booksList", booksList){
>> > >>
>> > >>                         public void populateItem(ListItem item) {
>> > >>
>> > >>                                 add(new Link("editLink") {
>> > >>                                         EditBook page =
>> > >> EditBook.getInstance ();
>> > >>                                         page.setModel(new
>> > >> CompoundPropertyModel(item.getModelObject ())); //or
>> > >> line also move to page
>> > >>                                         setResponsePage(page);
>> > >>                         }
>> > >>                 });
>> > >>         }
>> > >> }
>> > >>
>> > >> if i can do this then what effects do it put in on end-user of app?
>> > >>
>> > >> > you can reuse pages just fine for one session ofcourse if you
>> want.
>> > >> >
>> > >> > So in youre BookList you hold on to an internal page BookDetails
>> or
>> >
>> > >> > EditBook
>> > >> > page
>> > >> > And when you click on a view/edit link you just reuse that page.
>> > >> >
>> > >> > I wouldn't share pages across sessions.
>> > >> >
>> > >> > johan
>> > >> >
>> > >> >
>> > >> > On 3/20/06, ali < [EMAIL PROTECTED] > wrote:
>> > >> >>
>> > >> >> i am new in wicket , it's correct that we tell
>> > >> >>
>> > >> >> 1- always use getPageFactory.newPage() instead "new".
>> > >> >>
>> > >> >> 2- if a user view/edit 4 book in its session , for him/her
>> created
>> > 4
>> > >> >> BookDetails and 4 EditBook page object.(why this needed)
>> > >> >>
>> > >> >> do we can define page be singleton in level of handler thread or
>> > >> session
>> > >> >> (i remember ThreadLocal)? so that like swing only once EditBook
>> or
>> >
>> > >> >> BookDetails pages instanced and for next book only needed that
>> > call
>> > >> on
>> > >> >> them setBook(booK);
>> > >> >>
>> > >> >> refrence to these pages can keep in session and also they can
>> > >> >>
>> > >> >> or maybe i must more read examples and docs
>> > >> >>
>> > >> >> --
>> > >> >> Using Opera's revolutionary e-mail client:
>> > http://www.opera.com/mail/
>> > >> >>
>> > >> >>
>> > >> >> -------------------------------------------------------
>> > >> >> This SF.Net email is sponsored by xPML, a groundbreaking
>> scripting
>> >
>> > >> >> language
>> > >> >> that extends applications into web and mobile media. Attend the
>> > live
>> > >> >> webcast
>> > >> >> and join the prime developer group breaking into this new coding
>> > >> >> territory!
>> > >> >>
>> > >>
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>> >
>> > >> >> _______________________________________________
>> > >> >> Wicket-user mailing list
>> > >> >> Wicket-user@lists.sourceforge.net
>> > >> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> > >> >>
>> > >>
>> > >>
>> > >>
>> > >> --
>> > >> Using Opera's revolutionary e-mail client:
>> http://www.opera.com/mail/
>> > >>
>> > >>
>> > >> -------------------------------------------------------
>> > >> This SF.Net email is sponsored by xPML, a groundbreaking scripting
>> > >> language
>> > >> that extends applications into web and mobile media. Attend the
>> live
>> > >> webcast
>> > >> and join the prime developer group breaking into this new coding
>> > >> territory!
>> > >>
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>> >
>> > >> _______________________________________________
>> > >> Wicket-user mailing list
>> > >> Wicket-user@lists.sourceforge.net
>> > >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> > >>
>> > >
>> > >
>> > >
>> > > --
>> > > Cast your final vote for Wicket in the SourceForge.net 2006
>> Community
>> > > Choice
>> > > Awards!
>> > > http://www.wilsonresearch.com/2006/ostgawards06/ostgawards4.php
>> >
>> >
>> >
>> > --
>> > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>> >
>> >
>> > -------------------------------------------------------
>> > This SF.Net email is sponsored by xPML, a groundbreaking scripting
>> > language
>> > that extends applications into web and mobile media. Attend the live
>> > webcast
>> > and join the prime developer group breaking into this new coding
>> > territory!
>> >
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>> >
>> > _______________________________________________
>> > Wicket-user mailing list
>> > Wicket-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>>
>>
>>
>> --
>>
>> Cast your final vote for Wicket in the SourceForge.net 2006 Community
>> Choice Awards!
>> http://www.wilsonresearch.com/2006/ostgawards06/ostgawards4.php
>>



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to