one advantage of doing so would be decreased server load in term of
processor cycles.
Consider a quite complex page (i.e. page creation is expensive due to a
large number of objects/components in the hierarchy).
And i have a usecase where the page is not versioned and will always
show the latest snapshot of something, for example some measurement
readings.
In this case to me it perfectly makes sense to just have a single
instance of this page per session, and agreed, it was pretty simple to
implement such behaviour with wicket.

Marco


Igor Vaynberg wrote:
> you still havent explained exactly what the point is? and what you want to
> do is easily achieved.
> 
> create your own page factory that keeps a map:class->instance in the
> session
> object, that way wicket will always use that singleton instance whenever
> you
> do things like setResponsePage(Blah.class)
> 
> also never create a page using the new operator, always do it through the
> pagefactory.
> 
> and there you go.
> 
> i still dont see any advantages, only disadvantages, but the usecase can be
> easily implemented nontheless.
> 
> -Igor
> 
> 
> On 5/6/06, ali <[EMAIL PROTECTED]> wrote:
> 
>>
>> sorry for come late.
>> but i talk about singleton page in level of session/user and not in level
>> application
>>
>> user1 has one and only one instance of page A
>> user2 has one and only one instance of page A (not equals with page of
>> user1)
>> ==========
>> On Tue, 21 Mar 2006 12:11:45 +0430, 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
>> >> >> >> [email protected]
>> >> >> >> 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
>> >> >> [email protected]
>> >> >> 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
>> >> [email protected]
>> >> 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/
>>
>>
>> -------------------------------------------------------
>> Using Tomcat but need to do more? Need to support web services, security?
>> Get stuff done quickly with pre-integrated technology to make your job
>> easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>> http://sel.as-us.falkag.net/sel?cmdlnk&kid0709&bid&3057&dat1642
>> _______________________________________________
>> Wicket-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
> 

-- 
___________________________

Dipl.-Ing. Marco Geier
EyeTea GmbH
Germany
phone   +49 (0)721 662464-0
fax     +49 (0)721 662464-1
mobile  +49 (0)177 6579590
[EMAIL PROTECTED]


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to