-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Any method not recreate the desktop,page and components when refresh browser,and only retrieve the existed Page Object and redraw?I debug DHtmlLayoutServlet,find when refresh Browser,DHtmlLayoutServlet will create new Desktop and Page and Components each time,old Object seems be discard.(I want to use zk in my portal environment to develop portlet,In the portal page,there maybe other portlet not develop using ajax technology,so operation in non-ajax-portlet may result in whole portal page refresh.so how can I keep the component state of the zk-portlet)
I am confused about the concept:Desktop and Page,ZK document say Desktop may contain many pages,what 's meaning?any example about one desktop contain many pages?what's relationship about URL,Desktop and Page?
@likebean
Hi likebean, as you see, if you refresh browser, we will create new Desktop & Components.
I'm afraid to inform you that we don't have any method to stop this unless you edited the codes.
And here is a example about pages in the same desktop.
In zul
<zk> <page> ... </page> <page> ... </page> </zk>
/Joy
Can this feature add in ZK 5.0?because I think serverside executing is the most different and advantage when compare ZK with other ajax-web framework like GWT.If not only using ajax style but also keeping components state when refreshing browser,It's cool,and will be great feature of ZK!
L.J.W
@likebean
Of cause yes, you can post here. If that is a correct way and lot of people need it, we should have some change for it.
Thanks for your suggestion.
/Joy
Hi joylo,I try to keep id of Desktop and Page Object in Session,when refresh browser,I retrieve Desktop and Page Object throught these id, and reimplement UiEngine execNewPage0 method,not recreate page and components,and invoke code of Cycle 3: Generate output directly,now I refresh browser,page and components state keep,but I found a ajax requst /zkau?dtid=g4nh&cmd_0=rmDesktop send to server immediately,so when I refersh browser again,Desktop could not be retrieve again..Why and how?
Best rgds
L.J.W
You may feel interested to read about this option: keep-across-visits.
By specifying this option, the desktop will not be removed automaticaly on the server side when the HTML page is unloaded (and then reloaded). However, by doing so, you should also consider when to actually remove desktops that no long being used by the clients. Otherwise, your server memory will be overwhelmed by useless desktop very soon. There is a max-desktop-per-session counter, so it shall not crash your system. It will still use much more memory: by default, up to 20 times more (as max-desktop-per-session = 20).
You can use the DesktopRecycle approach here.
Create a class which implements org.zkoss.zk.ui.util.DesktopRecycle
in beforeRemove method push the desktop object to the session.
in beforeService method pull the deskop from the session and return.
in afterService is the session doesn't have the deskop object, push the desktop to session.
in ZK.xml file add this above class as a listener.
You should be all set.. with this when you refresh the browser, the UI state would retain as it was before refresh.
Asked: 2009-11-28 23:03:37 +0800
Seen: 1,941 times
Last updated: Jul 24 '12